Dynomotion

Group: DynoMotion Message: 13365 From: gyelle10 Date: 6/16/2016
Subject: Stand alone application

Hello,


I ordered a KFLOP board few days ago for a laser cutting application and since then, I read many topics on the forum and almost all the user manual. I'm trying to figure out how I will implement my application on the board and I have some questions to clarify some points. First here is what my application has to do :


A client will produce a DXF file, which will be converted into G Code using LazyCam or any program. Then the G Code file will be converted into coordinated motion with the Gcode interpreter (With specific velocity and acceleration). As I said, it is a laser cutting application so it also needs a PWM output with variable frequency and duty cycle (to set the power of the CO2 Laser). From now the client was on his computer but once the settings are done, it will be uploaded to the flash memory and will run in stand alone. From there, the client has an HMI connected to a PLC and may have to change the feed rate and the power of the laser (duty cycle of the PWM). He also may have to switch from a path to an other (which have been uploaded to the flash memory previously)


My questions are :


1. Is it possible to upload many G code project (converted into coordinated motion) into the flash memory and then use an external command (in stand alone mode) to load a specific project into the Coordinated Motion Buffer ?


2. Is it possible to change the velocity (feed rate) and the duty cycle / frequency of a PWM output with external command (in stand alone mode) ?


3. Once the program is uploaded in the flash memory, can I come back to the computer, add an other project (coordinated motion) to flash memory and then select this project "easily" with external command or do I need to modofy the C program. What I tought here is the following sequence : 


1- I read received  ASCII command with RS232 which contain the name of the sequence or the       enplacement of the sequence

2- Load this sequence to the buffer

3- Execute the buffer


Concerning the PWM output, I know that the frequency is set by dividing the clock (16.67 MHz) with entire number so I may not have the specific frequency for the laser (I don't have this information yet but it is in the range of 10 kHz to 100 kHz). If I can't get it, I could use a I/O bit to know when laser has to be ON/OFF and generate a PWM with external composants.


I may look a bit confused (I do not have received the KFLOP board yet). I also started to work with controllers recently so I'm not an expert.. If you have some advices concerning this application they are welcome :)



Thank you very much,


Guillaume





Group: DynoMotion Message: 13366 From: gyelle10 Date: 6/16/2016
Subject: Stand alone application

Hello,


I ordered a KFLOP board few days ago for a laser cutting application and since then, I read many topics on the forum and almost all the user manual. I'm trying to figure out how I will implement my application on the board and I have some questions to clarify some points. First here is what my application has to do :


A client will produce a DXF file, which will be converted into G Code using LazyCam or any program. Then the G Code file will be converted into coordinated motion with the Gcode interpreter (With specific velocity and acceleration). As I said, it is a laser cutting application so it also needs a PWM output with variable frequency and duty cycle (to set the power of the CO2 Laser). From now the client was on his computer but once the settings are done, it will be uploaded to the flash memory and will run in stand alone. From there, the client has an HMI connected to a PLC and may have to change the feed rate and the power of the laser (duty cycle of the PWM). He also may have to switch from a path to an other (which have been uploaded to the flash memory previously)


My questions are :


1. Is it possible to upload many G code project (converted into coordinated motion) into the flash memory and then use an external command (in stand alone mode) to load a specific project into the Coordinated Motion Buffer ?


2. Is it possible to change the velocity (feed rate) and the duty cycle / frequency of a PWM output with external command (in stand alone mode) ?


3. Once the program is uploaded in the flash memory, can I come back to the computer, add an other project (coordinated motion) to flash memory and then select this project "easily" with external command or do I need to modofy the C program. What I tought here is the following sequence : 


1- I read received  ASCII command with RS232 which contain the name of the sequence or the       enplacement of the sequence

2- Load this sequence to the buffer

3- Execute the buffer


Concerning the PWM output, I know that the frequency is set by dividing the clock (16.67 MHz) with entire number so I may not have the specific frequency for the laser (I don't have this information yet but it is in the range of 10 kHz to 100 kHz). If I can't get it, I could use a I/O bit to know when laser has to be ON/OFF and generate a PWM with external composants.


I may look a bit confused (I do not have received the KFLOP board yet). I also started to work with controllers recently so I'm not an expert.. If you have some advices concerning this application they are welcome :)



Thank you very much,


Guillaume





Group: DynoMotion Message: 13367 From: Moray Cuthill Date: 6/16/2016
Subject: Re: Stand alone application
Hi Guilllaume,

Have you installed KMotion, and had a look at the example files?
There is an example directory ("C programs" within the Kmotion installation directory), and there are a few different examples that use PWM, and should help you understand how to use the PWM.

Storing programs in flash, and on the fly adjustments to speed/PWM are possible, but I'm not sure about uploading/storing new code without connecting a computer. I suspect it may be possible, but I'll wait for somebody more knowledgeable to confirm.

We obviously don't know your exact machine design, but have you considered using a touch screen computer running windows instead of an HMI/PLC, then wire any required buttons/controls directly into the KFlop to provide the required controls?
That way you could alter KMotionCNC or even design your own program, to suit your requirements, and not rely on having to flash code directly into the KFlop. But that obviously depends on if you need the PLC to control other functions on the machine.

Moray


On Thu, Jun 16, 2016 at 4:52 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hello,


I ordered a KFLOP board few days ago for a laser cutting application and since then, I read many topics on the forum and almost all the user manual. I'm trying to figure out how I will implement my application on the board and I have some questions to clarify some points. First here is what my application has to do :


A client will produce a DXF file, which will be converted into G Code using LazyCam or any program. Then the G Code file will be converted into coordinated motion with the Gcode interpreter (With specific velocity and acceleration). As I said, it is a laser cutting application so it also needs a PWM output with variable frequency and duty cycle (to set the power of the CO2 Laser). From now the client was on his computer but once the settings are done, it will be uploaded to the flash memory and will run in stand alone. From there, the client has an HMI connected to a PLC and may have to change the feed rate and the power of the laser (duty cycle of the PWM). He also may have to switch from a path to an other (which have been uploaded to the flash memory previously)


My questions are :


1. Is it possible to upload many G code project (converted into coordinated motion) into the flash memory and then use an external command (in stand alone mode) to load a specific project into the Coordinated Motion Buffer ?


2. Is it possible to change the velocity (feed rate) and the duty cycle / frequency of a PWM output with external command (in stand alone mode) ?


3. Once the program is uploaded in the flash memory, can I come back to the computer, add an other project (coordinated motion) to flash memory and then select this project "easily" with external command or do I need to modofy the C program. What I tought here is the following sequence : 


1- I read received  ASCII command with RS232 which contain the name of the sequence or the       enplacement of the sequence

2- Load this sequence to the buffer

3- Execute the buffer


Concerning the PWM output, I know that the frequency is set by dividing the clock (16.67 MHz) with entire number so I may not have the specific frequency for the laser (I don't have this information yet but it is in the range of 10 kHz to 100 kHz). If I can't get it, I could use a I/O bit to know when laser has to be ON/OFF and generate a PWM with external composants.


I may look a bit confused (I do not have received the KFLOP board yet). I also started to work with controllers recently so I'm not an expert.. If you have some advices concerning this application they are welcome :)



Thank you very much,


Guillaume






Group: DynoMotion Message: 13368 From: gyelle10 Date: 6/16/2016
Subject: Re: Stand alone application
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume


Group: DynoMotion Message: 13370 From: Tom Kerekes Date: 6/16/2016
Subject: Re: Stand alone application

Hi Guillaume,

I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?


But for stand alone operation I see two basic approaches:

#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.

I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".

You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.

#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 

Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.

In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.

HTH

Regards

TK






On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume



Group: DynoMotion Message: 13398 From: gyelle10 Date: 6/28/2016
Subject: Re: Stand alone application
Hello Tom,

First thanks for the support ! I just began to work with my Kflop and I like it. 

Concerning your last response I'll give a try with the first option. I may have to do some weird pathern so creating the Coordinated motion on-the-fly would be tricky.. My only concern with the first option is the amount of flash memory.. My pathern will consist of many circles or sort of squares so I hope it will have enough memory to store at least 1 pathern. 

For now, I'm testing some feature and I have an issue.. :

When I execute Gcode with KmotionCNC and let it finish, (it consist of a simple circle and it executes perfecly) and then I try to re-execute it with the ExecBuf command in a C program, nothing happens. The program is quite simple.. :

            #include "KMotionDef.h"
            #include "CoordMotionInKFLOP.c"

            main()
                {
                    ExecBuf;
                 }

 I thought the GCode Interpreter would have created Coordinated Motion Segments and stored it in the KFlop's buffer and then with "ExecBuf" I could re-execute it. Am I missing something ? (probably..)

Thanks in advance,

Guillaume









On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume





Group: DynoMotion Message: 13402 From: Tom Kerekes Date: 6/29/2016
Subject: Re: Stand alone application

Hi Guillaume,

You must reset the starting point back to the beginning and when calling a C Function you must include parenthesis otherwise the C compiler just evaluates the address of the function rather than executing it.

See the attached example.

Regards

TK


On 6/28/2016 2:14 PM, gyelle10@... [DynoMotion] wrote:
 
Hello Tom,

First thanks for the support ! I just began to work with my Kflop and I like it. 

Concerning your last response I'll give a try with the first option. I may have to do some weird pathern so creating the Coordinated motion on-the-fly would be tricky.. My only concern with the first option is the amount of flash memory.. My pathern will consist of many circles or sort of squares so I hope it will have enough memory to store at least 1 pathern. 

For now, I'm testing some feature and I have an issue.. :

When I execute Gcode with KmotionCNC and let it finish, (it consist of a simple circle and it executes perfecly) and then I try to re-execute it with the ExecBuf command in a C program, nothing happens. The program is quite simple.. :

            #include "KMotionDef.h"
            #include "CoordMotionInKFLOP.c"

            main()
                {
                    ExecBuf;
                 }

 I thought the GCode Interpreter would have created Coordinated Motion Segments and stored it in the KFlop's buffer and then with "ExecBuf" I could re-execute it. Am I missing something ? (probably..)

Thanks in advance,

Guillaume









On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume






  @@attachment@@
Group: DynoMotion Message: 13405 From: gyelle10 Date: 6/29/2016
Subject: Re: Stand alone application [1 Attachment]
Hi Tom,

Your example works fine thank you!

Is there a way to get more Flash memory ? Like an extension card or something like that ? I did a litle project and it takes 1160 Coordinated Motion Segments and I'll need to flash much more then that for my application... (I'm affraid 4800 segments will not be enough..)

Thanks in advance,

Guillaume
 




On Wednesday, June 29, 2016 2:23 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
[Attachment(s) from Tom Kerekes included below]
Hi Guillaume,
You must reset the starting point back to the beginning and when calling a C Function you must include parenthesis otherwise the C compiler just evaluates the address of the function rather than executing it.
See the attached example.
Regards
TK

On 6/28/2016 2:14 PM, gyelle10@... [DynoMotion] wrote:
 
Hello Tom,

First thanks for the support ! I just began to work with my Kflop and I like it. 

Concerning your last response I'll give a try with the first option. I may have to do some weird pathern so creating the Coordinated motion on-the-fly would be tricky.. My only concern with the first option is the amount of flash memory.. My pathern will consist of many circles or sort of squares so I hope it will have enough memory to store at least 1 pathern. 

For now, I'm testing some feature and I have an issue.. :

When I execute Gcode with KmotionCNC and let it finish, (it consist of a simple circle and it executes perfecly) and then I try to re-execute it with the ExecBuf command in a C program, nothing happens. The program is quite simple.. :

            #include "KMotionDef.h"
            #include "CoordMotionInKFLOP.c"

            main()
                {
                    ExecBuf;
                 }

 I thought the GCode Interpreter would have created Coordinated Motion Segments and stored it in the KFlop's buffer and then with "ExecBuf" I could re-execute it. Am I missing something ? (probably..)

Thanks in advance,

Guillaume









On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume








Group: DynoMotion Message: 13406 From: Tom Kerekes Date: 6/29/2016
Subject: Re: Stand alone application
Hi Guillaume,

Not easily without adding a PC :)

Whatever amount of User Program Space of 11 x 64K = 720K = 3300 segments that you don't utilize can also be used.  See:
http://www.dynomotion.com/wiki/index.php?title=KFLOP_C_Programs#C_Program_Size_and_Stack_Limitations


How the GCode is written and certain Trajectory Planner Settings may allow you to reduce the number of final segments.  If you send an example of your GCode, accuracy requirements, and trajectory planner settings we may be able to help

Regards

TK




On 6/29/2016 1:02 PM, gyelle10@... [DynoMotion] wrote:
 
Hi Tom,

Your example works fine thank you!

Is there a way to get more Flash memory ? Like an extension card or something like that ? I did a litle project and it takes 1160 Coordinated Motion Segments and I'll need to flash much more then that for my application... (I'm affraid 4800 segments will not be enough..)

Thanks in advance,

Guillaume
 




On Wednesday, June 29, 2016 2:23 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
[Attachment(s) from Tom Kerekes included below]
Hi Guillaume,
You must reset the starting point back to the beginning and when calling a C Function you must include parenthesis otherwise the C compiler just evaluates the address of the function rather than executing it.
See the attached example.
Regards
TK

On 6/28/2016 2:14 PM, gyelle10@... [DynoMotion] wrote:
 
Hello Tom,

First thanks for the support ! I just began to work with my Kflop and I like it. 

Concerning your last response I'll give a try with the first option. I may have to do some weird pathern so creating the Coordinated motion on-the-fly would be tricky.. My only concern with the first option is the amount of flash memory.. My pathern will consist of many circles or sort of squares so I hope it will have enough memory to store at least 1 pathern. 

For now, I'm testing some feature and I have an issue.. :

When I execute Gcode with KmotionCNC and let it finish, (it consist of a simple circle and it executes perfecly) and then I try to re-execute it with the ExecBuf command in a C program, nothing happens. The program is quite simple.. :

            #include "KMotionDef.h"
            #include "CoordMotionInKFLOP.c"

            main()
                {
                    ExecBuf;
                 }

 I thought the GCode Interpreter would have created Coordinated Motion Segments and stored it in the KFlop's buffer and then with "ExecBuf" I could re-execute it. Am I missing something ? (probably..)

Thanks in advance,

Guillaume









On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume









Group: DynoMotion Message: 13407 From: Hardy Family Date: 6/29/2016
Subject: Re: Stand alone application
I haven't actually tried this, so YMMV, but compression might work for you.

Each motion segment takes 216 bytes, but if you look at the actual structure (PARAMETRIC_COEFF) then you will see that many of the values will be unused in your application, so you should be able to compress these structs quite nicely.

For example, if you are only using 3-axis then you can throw away the axis-related fields for a,b,c,u,v (but not the t^N coefficients which happen to be called a,b,c!).  This would cut the size down to 128 bytes with very little effort.

With more effort, you'll find other optimizations like storing only as many bits as actually needed for the char and short fields.  You might even get away with throwing away some of the double precision e.g. store in 6 bytes instead of 8.  For example, the first field is the motion type, and it only has to store the values 0..5, which can be done with 3 bits instead of the allocated 8.

So I think this would almost double your capacity if you only need 3 axis.  Are 9000 segments enough?

If that's still not enough, you can then use a general-purpose compressor like Lempel-Ziv, but that's a big project because you will have to port some open source code to the kflop.  Also, LZ/LZW don't always do so well when compressing binary (float) data.  You'd have to experiment on the PC first to see if it was worth while.

The gather buffer is about 8MB, so you can use that as a buffer when you compress/uncompress the data.

Regards,
SJH




On Wed, Jun 29, 2016 at 1:02 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Tom,

Your example works fine thank you!

Is there a way to get more Flash memory ? Like an extension card or something like that ? I did a litle project and it takes 1160 Coordinated Motion Segments and I'll need to flash much more then that for my application... (I'm affraid 4800 segments will not be enough..)

Thanks in advance,

Guillaume
 




On Wednesday, June 29, 2016 2:23 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
[Attachment(s) from Tom Kerekes included below]
Hi Guillaume,
You must reset the starting point back to the beginning and when calling a C Function you must include parenthesis otherwise the C compiler just evaluates the address of the function rather than executing it.
See the attached example.
Regards
TK

On 6/28/2016 2:14 PM, gyelle10@... [DynoMotion] wrote:
 
Hello Tom,

First thanks for the support ! I just began to work with my Kflop and I like it. 

Concerning your last response I'll give a try with the first option. I may have to do some weird pathern so creating the Coordinated motion on-the-fly would be tricky.. My only concern with the first option is the amount of flash memory.. My pathern will consist of many circles or sort of squares so I hope it will have enough memory to store at least 1 pathern. 

For now, I'm testing some feature and I have an issue.. :

When I execute Gcode with KmotionCNC and let it finish, (it consist of a simple circle and it executes perfecly) and then I try to re-execute it with the ExecBuf command in a C program, nothing happens. The program is quite simple.. :

            #include "KMotionDef.h"
            #include "CoordMotionInKFLOP.c"

            main()
                {
                    ExecBuf;
                 }

 I thought the GCode Interpreter would have created Coordinated Motion Segments and stored it in the KFlop's buffer and then with "ExecBuf" I could re-execute it. Am I missing something ? (probably..)

Thanks in advance,

Guillaume









On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume









Group: DynoMotion Message: 13408 From: gyelle10 Date: 6/30/2016
Subject: Re: Stand alone application
 Hello guys,

I noticed that when I execute my GCode within KMotionCNC and then execute the CoordMotionBuffer, I only have 30 segments, and when I execute the GCode within KMotion and then execute the CoordMotionBuffer, it takes 3045 segments. Both execution of the buffer has the same result and it's the good one. Do you know why there is a major difference in the numer of segments ? Would it works fine if I flash the 30 segments produced with KMotionCNC and then load/execute it again ? 

I only use 2 axis for now, I may use the 3rd axis to control the laser PWM (I'm still not sure) but I won't use more axis so I could use their memory. Is there any example on how to release the axis-related fields for a,b,c,u,v  and on how to use it after  ? I'm not really used to working with controllers *:| straight face.


The GCode I use for now is the following : 
It consist of an array of 8 circles but the application may need more circles per array and more rows. (I should have this information shortly). It also may be rows of different shape (not circles) in future projects.

N5 (File Name = Pièce142-3 on Thursday, June 30, 2016)
N10 (Default Plasma Post) 
N25 G0  X0.0  Y12.5
N30 M3(PLasma On)
N35 G4 P0.1000
N50 G3  X25.0000  Y12.5000  I12.5  J0  F18000
N55 G2X50.0000  Y12.5000  I12.5000  J-0.0000
N60 G3X75.0000  Y12.5000  I12.5000  J-0.0000 
N65 G2X100.0000  Y12.5000  I12.5000  J-0.0000 
N70 G3X125.0000  Y12.5000  I12.5000  J0.0000
N150 G2 X150.0000  Y12.5000  I12.5000  J0.0000 
N155 G3 X175.0000  Y12.5000  I12.5000  J0.0000 
N160  G2X200.0000  Y12.5000  I12.5000  J0.0000 
N165  X175.0000  Y12.5000  I-12.5000  J-0.0000 
N170  G3X150.0000  Y12.5000  I-12.5000  J-0.0000 
N175  G2X125.0000  Y12.5194  I-12.5000  J-0.0000  
N180  G3X100.0000  I-12.5000  J0.0000 
N1180  G2X75.0000  Y12.5000  I-12.5000  J0.0000 
N1185  G3X50.0000  Y12.5000  I-12.5000  J0.0000 
N1190  G2X25.0000  Y12.5000  I-12.5000  J0.0000 
N1195  G3X0.0000  Y12.5000  I-12.5000  J0.0000 
N11100  X0.0017  Y12.2924  I12.5000  J-0.0000 
N11105 G4P0.10
N11110 M5 (Plasma Off)
N11195 M30

Thanks alot for your support, 

Guillaume






On Wednesday, June 29, 2016 4:56 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
I haven't actually tried this, so YMMV, but compression might work for you.

Each motion segment takes 216 bytes, but if you look at the actual structure (PARAMETRIC_COEFF) then you will see that many of the values will be unused in your application, so you should be able to compress these structs quite nicely.

For example, if you are only using 3-axis then you can throw away the axis-related fields for a,b,c,u,v (but not the t^N coefficients which happen to be called a,b,c!).  This would cut the size down to 128 bytes with very little effort.

With more effort, you'll find other optimizations like storing only as many bits as actually needed for the char and short fields.  You might even get away with throwing away some of the double precision e.g. store in 6 bytes instead of 8.  For example, the first field is the motion type, and it only has to store the values 0..5, which can be done with 3 bits instead of the allocated 8.

So I think this would almost double your capacity if you only need 3 axis.  Are 9000 segments enough?

If that's still not enough, you can then use a general-purpose compressor like Lempel-Ziv, but that's a big project because you will have to port some open source code to the kflop.  Also, LZ/LZW don't always do so well when compressing binary (float) data.  You'd have to experiment on the PC first to see if it was worth while.

The gather buffer is about 8MB, so you can use that as a buffer when you compress/uncompress the data.

Regards,
SJH




On Wed, Jun 29, 2016 at 1:02 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi Tom,

Your example works fine thank you!

Is there a way to get more Flash memory ? Like an extension card or something like that ? I did a litle project and it takes 1160 Coordinated Motion Segments and I'll need to flash much more then that for my application... (I'm affraid 4800 segments will not be enough..)

Thanks in advance,

Guillaume
 




On Wednesday, June 29, 2016 2:23 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
[Attachment(s) from Tom Kerekes included below]
Hi Guillaume,
You must reset the starting point back to the beginning and when calling a C Function you must include parenthesis otherwise the C compiler just evaluates the address of the function rather than executing it.
See the attached example.
Regards
TK

On 6/28/2016 2:14 PM, gyelle10@... [DynoMotion] wrote:
 
Hello Tom,

First thanks for the support ! I just began to work with my Kflop and I like it. 

Concerning your last response I'll give a try with the first option. I may have to do some weird pathern so creating the Coordinated motion on-the-fly would be tricky.. My only concern with the first option is the amount of flash memory.. My pathern will consist of many circles or sort of squares so I hope it will have enough memory to store at least 1 pathern. 

For now, I'm testing some feature and I have an issue.. :

When I execute Gcode with KmotionCNC and let it finish, (it consist of a simple circle and it executes perfecly) and then I try to re-execute it with the ExecBuf command in a C program, nothing happens. The program is quite simple.. :

            #include "KMotionDef.h"
            #include "CoordMotionInKFLOP.c"

            main()
                {
                    ExecBuf;
                 }

 I thought the GCode Interpreter would have created Coordinated Motion Segments and stored it in the KFlop's buffer and then with "ExecBuf" I could re-execute it. Am I missing something ? (probably..)

Thanks in advance,

Guillaume









On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume











Group: DynoMotion Message: 13409 From: Tom Kerekes Date: 6/30/2016
Subject: Re: Stand alone application
Hi Guillaume,

What are your trajectory planner settings?  Specifically convert "Arcs to sets". 

Regards

TK

On Jun 30, 2016, at 8:11 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

 

 Hello guys,

I noticed that when I execute my GCode within KMotionCNC and then execute the CoordMotionBuffer, I only have 30 segments, and when I execute the GCode within KMotion and then execute the CoordMotionBuffer, it takes 3045 segments. Both execution of the buffer has the same result and it's the good one. Do you know why there is a major difference in the numer of segments ? Would it works fine if I flash the 30 segments produced with KMotionCNC and then load/execute it again ? 

I only use 2 axis for now, I may use the 3rd axis to control the laser PWM (I'm still not sure) but I won't use more axis so I could use their memory. Is there any example on how to release the axis-related fields for a,b,c,u,v  and on how to use it after  ? I'm not really used to working with controllers *:| straight face.


The GCode I use for now is the following : 
It consist of an array of 8 circles but the application may need more circles per array and more rows. (I should have this information shortly). It also may be rows of different shape (not circles) in future projects.

N5 (File Name = Pièce142-3 on Thursday, June 30, 2016)
N10 (Default Plasma Post) 
N25 G0  X0.0  Y12.5
N30 M3(PLasma On)
N35 G4 P0.1000
N50 G3  X25.0000  Y12.5000  I12.5  J0  F18000
N55 G2X50.0000  Y12.5000  I12.5000  J-0.0000
N60 G3X75.0000  Y12.5000  I12.5000  J-0.0000 
N65 G2X100.0000  Y12.5000  I12.5000  J-0.0000 
N70 G3X125.0000  Y12.5000  I12.5000  J0.0000
N150 G2 X150.0000  Y12.5000  I12.5000  J0.0000 
N155 G3 X175.0000  Y12.5000  I12.5000  J0.0000 
N160  G2X200.0000  Y12.5000  I12.5000  J0.0000 
N165  X175.0000  Y12.5000  I-12.5000  J-0.0000 
N170  G3X150.0000  Y12.5000  I-12.5000  J-0.0000 
N175  G2X125.0000  Y12.5194  I-12.5000  J-0.0000  
N180  G3X100.0000  I-12.5000  J0.0000 
N1180  G2X75.0000  Y12.5000  I-12.5000  J0.0000 
N1185  G3X50.0000  Y12.5000  I-12.5000  J0.0000 
N1190  G2X25.0000  Y12.5000  I-12.5000  J0.0000 
N1195  G3X0.0000  Y12.5000  I-12.5000  J0.0000 
N11100  X0.0017  Y12.2924  I12.5000  J-0.0000 
N11105 G4P0.10
N11110 M5 (Plasma Off)
N11195 M30

Thanks alot for your support, 

Guillaume






On Wednesday, June 29, 2016 4:56 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
I haven't actually tried this, so YMMV, but compression might work for you.

Each motion segment takes 216 bytes, but if you look at the actual structure (PARAMETRIC_COEFF) then you will see that many of the values will be unused in your application, so you should be able to compress these structs quite nicely.

For example, if you are only using 3-axis then you can throw away the axis-related fields for a,b,c,u,v (but not the t^N coefficients which happen to be called a,b,c!).  This would cut the size down to 128 bytes with very little effort.

With more effort, you'll find other optimizations like storing only as many bits as actually needed for the char and short fields.  You might even get away with throwing away some of the double precision e.g. store in 6 bytes instead of 8.  For example, the first field is the motion type, and it only has to store the values 0..5, which can be done with 3 bits instead of the allocated 8.

So I think this would almost double your capacity if you only need 3 axis.  Are 9000 segments enough?

If that's still not enough, you can then use a general-purpose compressor like Lempel-Ziv, but that's a big project because you will have to port some open source code to the kflop.  Also, LZ/LZW don't always do so well when compressing binary (float) data.  You'd have to experiment on the PC first to see if it was worth while.

The gather buffer is about 8MB, so you can use that as a buffer when you compress/uncompress the data.

Regards,
SJH




On Wed, Jun 29, 2016 at 1:02 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi Tom,

Your example works fine thank you!

Is there a way to get more Flash memory ? Like an extension card or something like that ? I did a litle project and it takes 1160 Coordinated Motion Segments and I'll need to flash much more then that for my application... (I'm affraid 4800 segments will not be enough..)

Thanks in advance,

Guillaume
 




On Wednesday, June 29, 2016 2:23 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
[Attachment(s) from Tom Kerekes included below]
Hi Guillaume,
You must reset the starting point back to the beginning and when calling a C Function you must include parenthesis otherwise the C compiler just evaluates the address of the function rather than executing it.
See the attached example.
Regards
TK

On 6/28/2016 2:14 PM, gyelle10@... [DynoMotion] wrote:
 
Hello Tom,

First thanks for the support ! I just began to work with my Kflop and I like it. 

Concerning your last response I'll give a try with the first option. I may have to do some weird pathern so creating the Coordinated motion on-the-fly would be tricky.. My only concern with the first option is the amount of flash memory.. My pathern will consist of many circles or sort of squares so I hope it will have enough memory to store at least 1 pathern. 

For now, I'm testing some feature and I have an issue.. :

When I execute Gcode with KmotionCNC and let it finish, (it consist of a simple circle and it executes perfecly) and then I try to re-execute it with the ExecBuf command in a C program, nothing happens. The program is quite simple.. :

            #include "KMotionDef.h"
            #include "CoordMotionInKFLOP.c"

            main()
                {
                    ExecBuf;
                 }

 I thought the GCode Interpreter would have created Coordinated Motion Segments and stored it in the KFlop's buffer and then with "ExecBuf" I could re-execute it. Am I missing something ? (probably..)

Thanks in advance,

Guillaume









On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume











Group: DynoMotion Message: 13410 From: gyelle10 Date: 6/30/2016
Subject: Re: Stand alone application
«Hi Tom,

I joined my trajectory planner settings. Arcs to segments is not check. Is this what you  meant ?

Guillaume
 




On Thursday, June 30, 2016 1:00 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,

What are your trajectory planner settings?  Specifically convert "Arcs to sets". 

Regards

TK

On Jun 30, 2016, at 8:11 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

 
 Hello guys,

I noticed that when I execute my GCode within KMotionCNC and then execute the CoordMotionBuffer, I only have 30 segments, and when I execute the GCode within KMotion and then execute the CoordMotionBuffer, it takes 3045 segments. Both execution of the buffer has the same result and it's the good one. Do you know why there is a major difference in the numer of segments ? Would it works fine if I flash the 30 segments produced with KMotionCNC and then load/execute it again ? 

I only use 2 axis for now, I may use the 3rd axis to control the laser PWM (I'm still not sure) but I won't use more axis so I could use their memory. Is there any example on how to release the axis-related fields for a,b,c,u,v  and on how to use it after  ? I'm not really used to working with controllers *:| straight face.


The GCode I use for now is the following : 
It consist of an array of 8 circles but the application may need more circles per array and more rows. (I should have this information shortly). It also may be rows of different shape (not circles) in future projects.

N5 (File Name = Pièce142-3 on Thursday, June 30, 2016)
N10 (Default Plasma Post) 
N25 G0  X0.0  Y12.5
N30 M3(PLasma On)
N35 G4 P0.1000
N50 G3  X25.0000  Y12.5000  I12.5  J0  F18000
N55 G2X50.0000  Y12.5000  I12.5000  J-0.0000
N60 G3X75.0000  Y12.5000  I12.5000  J-0.0000 
N65 G2X100.0000  Y12.5000  I12.5000  J-0.0000 
N70 G3X125.0000  Y12.5000  I12.5000  J0.0000
N150 G2 X150.0000  Y12.5000  I12.5000  J0.0000 
N155 G3 X175.0000  Y12.5000  I12.5000  J0.0000 
N160  G2X200.0000  Y12.5000  I12.5000  J0.0000 
N165  X175.0000  Y12.5000  I-12.5000  J-0.0000 
N170  G3X150.0000  Y12.5000  I-12.5000  J-0.0000 
N175  G2X125.0000  Y12.5194  I-12.5000  J-0.0000  
N180  G3X100.0000  I-12.5000  J0.0000 
N1180  G2X75.0000  Y12.5000  I-12.5000  J0.0000 
N1185  G3X50.0000  Y12.5000  I-12.5000  J0.0000 
N1190  G2X25.0000  Y12.5000  I-12.5000  J0.0000 
N1195  G3X0.0000  Y12.5000  I-12.5000  J0.0000 
N11100  X0.0017  Y12.2924  I12.5000  J-0.0000 
N11105 G4P0.10
N11110 M5 (Plasma Off)
N11195 M30

Thanks alot for your support, 

Guillaume






On Wednesday, June 29, 2016 4:56 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
I haven't actually tried this, so YMMV, but compression might work for you.

Each motion segment takes 216 bytes, but if you look at the actual structure (PARAMETRIC_COEFF) then you will see that many of the values will be unused in your application, so you should be able to compress these structs quite nicely.

For example, if you are only using 3-axis then you can throw away the axis-related fields for a,b,c,u,v (but not the t^N coefficients which happen to be called a,b,c!).  This would cut the size down to 128 bytes with very little effort.

With more effort, you'll find other optimizations like storing only as many bits as actually needed for the char and short fields.  You might even get away with throwing away some of the double precision e.g. store in 6 bytes instead of 8.  For example, the first field is the motion type, and it only has to store the values 0..5, which can be done with 3 bits instead of the allocated 8.

So I think this would almost double your capacity if you only need 3 axis.  Are 9000 segments enough?

If that's still not enough, you can then use a general-purpose compressor like Lempel-Ziv, but that's a big project because you will have to port some open source code to the kflop.  Also, LZ/LZW don't always do so well when compressing binary (float) data.  You'd have to experiment on the PC first to see if it was worth while.

The gather buffer is about 8MB, so you can use that as a buffer when you compress/uncompress the data.

Regards,
SJH




On Wed, Jun 29, 2016 at 1:02 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi Tom,

Your example works fine thank you!

Is there a way to get more Flash memory ? Like an extension card or something like that ? I did a litle project and it takes 1160 Coordinated Motion Segments and I'll need to flash much more then that for my application... (I'm affraid 4800 segments will not be enough..)

Thanks in advance,

Guillaume
 




On Wednesday, June 29, 2016 2:23 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
[Attachment(s) from Tom Kerekes included below]
Hi Guillaume,
You must reset the starting point back to the beginning and when calling a C Function you must include parenthesis otherwise the C compiler just evaluates the address of the function rather than executing it.
See the attached example.
Regards
TK

On 6/28/2016 2:14 PM, gyelle10@... [DynoMotion] wrote:
 
Hello Tom,

First thanks for the support ! I just began to work with my Kflop and I like it. 

Concerning your last response I'll give a try with the first option. I may have to do some weird pathern so creating the Coordinated motion on-the-fly would be tricky.. My only concern with the first option is the amount of flash memory.. My pathern will consist of many circles or sort of squares so I hope it will have enough memory to store at least 1 pathern. 

For now, I'm testing some feature and I have an issue.. :

When I execute Gcode with KmotionCNC and let it finish, (it consist of a simple circle and it executes perfecly) and then I try to re-execute it with the ExecBuf command in a C program, nothing happens. The program is quite simple.. :

            #include "KMotionDef.h"
            #include "CoordMotionInKFLOP.c"

            main()
                {
                    ExecBuf;
                 }

 I thought the GCode Interpreter would have created Coordinated Motion Segments and stored it in the KFlop's buffer and then with "ExecBuf" I could re-execute it. Am I missing something ? (probably..)

Thanks in advance,

Guillaume









On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume













  @@attachment@@
Group: DynoMotion Message: 13411 From: Tom Kerekes Date: 6/30/2016
Subject: Re: Stand alone application [1 Attachment]
Hi Guillaume,

Which application are those from? Please post from both applications KMotionCNC.exe and KMotion.exe

Regards

TK

> On Jun 30, 2016, at 10:08 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
>
> Guillaume
Group: DynoMotion Message: 13418 From: Tom Kerekes Date: 6/30/2016
Subject: Re: Stand alone application [1 Attachment]

Hi Guillaume,

The beginning of the Coordinated motion buffer would be &ParametricCoeffs[0] (address of the 0th entry of the motion buffer)

The End of the data would be &ParametricCoeffs[ParametricIndex+1] (address of the next available segment including terminator segment)

Regards
TK

On 6/30/2016 11:40 AM, gyelle10@... wrote:
Hi Tom,

You are right, the diffence in the number of segments between Kmotion.exe and KmotionCNC.exe was the "Arc to segments", when this setting is uncheck, it only takes 68 segments to produce 3 rows of 8 circles and the result is still smooth circles *:) happy. (I updated my GCode to obtain theses 3 rows, you can find it lower in this mail). 

I'm now trying to save theses segments into flash memory.. I have to admit that I'm not really at ease to copy the CoordMotionBuffer into flash. I looked at the "WriteData.c" file found in the FlashNonVolatile programs and I understand a litle what happen here but I'm not sure how to copy the CoordMotionBuffer adresses instead of random values.
 

GCode :

N5 (File Name = Pièce142-3 on Thursday, June 30, 2016)
N10 (Default Plasma Post) 
N25 G1  X0.0  Y12.5
N35 G4 P0.1000
N50 G3 X25.0000  Y12.5000  I12.5  J0  F18000
N55 G2 X50.0000  Y12.5000  I12.5000  J-0.0000
N60 G3 X75.0000  Y12.5000  I12.5000  J-0.0000 
N65 G2 X100.0000 Y12.5000  I12.5000  J-0.0000 
N70 G3 X125.0000 Y12.5000  I12.5000  J0.0000
N80 G2 X150.0000 Y12.5000  I12.5000  J0.0000 
N85 G3 X175.0000 Y12.5000  I12.5000  J0.0000 
N90 G2 X200.0000 Y12.5000  I12.5000  J0.0000 
N95    X175.0000 Y12.5000  I-12.5000  J-0.0000 
N100  G3X150.0000  Y12.5000  I-12.5000  J-0.0000 
N105  G2X125.0000  Y12.5000  I-12.5000  J-0.0000  
N110  G3X100.0000  Y12.5000  I-12.5000  J0.0000 
N120  G2X75.0000   Y12.5000  I-12.5000  J0.0000 
N125  G3X50.0000   Y12.5000  I-12.5000  J0.0000 
N130  G2X25.0000   Y12.5000  I-12.5000  J0.0000 
N135  G3X0.0000    Y12.5000  I-12.5000  J0.0000
N145 G4P0.10
N155 G1 X0 Y38.5
N145 G4P0.10
N160 G3 X25.0000  Y38.5  I12.5  J0
N55 G2 X50.0000  Y38.5 I12.5000  J-0.0000
N60 G3 X75.0000  Y38.5  I12.5000  J-0.0000 
N65 G2 X100.0000 Y38.5 I12.5000  J-0.0000 
N70 G3 X125.0000 Y38.5  I12.5000  J0.0000
N80 G2 X150.0000 Y38.5  I12.5000  J0.0000 
N85 G3 X175.0000 Y38.5  I12.5000  J0.0000 
N90 G2 X200.0000 Y38.5  I12.5000  J0.0000 
N95    X175.0000 Y38.5  I-12.5000  J-0.0000 
N100  G3X150.0000  Y38.5  I-12.5000  J-0.0000 
N105  G2X125.0000  Y38.5  I-12.5000  J-0.0000  
N110  G3X100.0000  Y38.5  I-12.5000  J0.0000 
N120  G2X75.0000   Y38.5  I-12.5000  J0.0000 
N125  G3X50.0000   Y38.5  I-12.5000  J0.0000 
N130  G2X25.0000   Y38.5  I-12.5000  J0.0000 
N135  G3X0.0000    Y38.5  I-12.5000  J0.0000
N145 G4P0.10
N155 G1 X0 Y64.5
N145 G4P0.10
N160 G3 X25.0000  Y64.5  I12.5  J0
N55 G2 X50.0000  Y64.5 I12.5000  J-0.0000
N60 G3 X75.0000  Y64.5  I12.5000  J-0.0000 
N65 G2 X100.0000 Y64.5 I12.5000  J-0.0000 
N70 G3 X125.0000 Y64.5  I12.5000  J0.0000
N80 G2 X150.0000 Y64.5  I12.5000  J0.0000 
N85 G3 X175.0000 Y64.5  I12.5000  J0.0000 
N90 G2 X200.0000 Y64.5  I12.5000  J0.0000 
N95    X175.0000 Y64.5  I-12.5000  J-0.0000 
N100  G3X150.0000  Y64.5  I-12.5000  J-0.0000 
N105  G2X125.0000  Y64.5  I-12.5000  J-0.0000  
N110  G3X100.0000  Y64.5  I-12.5000  J0.0000 
N120  G2X75.0000   Y64.5  I-12.5000  J0.0000 
N125  G3X50.0000   Y64.5  I-12.5000  J0.0000 
N130  G2X25.0000   Y64.5  I-12.5000  J0.0000 
N135  G3X0.0000    Y64.5  I-12.5000  J0.0000
N11195 M30




Group: DynoMotion Message: 13438 From: gyelle10 Date: 7/4/2016
Subject: Re: Stand alone application
Hi Tom,

I need help with my Cprogram that copy the CoordMotionBuffer to the FLASH_USER. Here is my C program (I also attached to the mail)

#include "KMotionDef.h"


#include "KMotionDef.h"


main()
{
int T0,T1;
int Adress0 = &ParametricCoeffs[0];
int Adress_end = &ParametricCoeffs[ParametricIndex+1];
int N = Adress_end - Adress0;
// N is the number of adresses needed in the CoordMotionBuffer. It contains N/216 segments.
T0=Time_sec();
// write N bytes of the CoordMotionBuffer to the 2nd MByte of the Flash Chip
ProgramFlash((volatile char *)ParametricCoeffs,N/sizeof(short int),FLASH_USER,""); 
T1=Time_sec();
printf ("Flash Complete Erase+Programming time = %f seconds\n",T1-T0);

}

When I execute it (after I executed my project so the CoordMotionBuffer isn't empty, I verified it and N=14688) there is no errors and no warnings, but it takes 0.000000 seconds to complete the task (shown in the consol with the "printf" command). I guess my program doesn't work because it normaly takes  0.018062 seconds to copy the 16 bytes of the example program (WriteData.c)...

Do you know why it doesn't work ? I guess it is in the ProgramFlash(...) arguments.

Thanks again,

Guillaume



  @@attachment@@
Group: DynoMotion Message: 13441 From: Hardy Family Date: 7/4/2016
Subject: Re: Stand alone application [1 Attachment]
You are defining T0 and T1 as int.  Define them as 'double', otherwise it will truncate to a whole number of seconds.

In C, you have to be very aware of data types.  It's a low-level language (one step up from assembler).

You are setting pointers (addresses) directly into 'int'.  Although the compiler allows this, it's not good practice.  Instead of doing that complicated address arithmetic, if you want to find the number of bytes to program then put:

int N = (ParametricIndex+1)*sizeof(ParametricCoeffs[0]);

Regards,
SJH





On Mon, Jul 4, 2016 at 9:28 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... [DynoMotion] included below]

Hi Tom,


I need help with my Cprogram that copy the CoordMotionBuffer to the FLASH_USER. Here is my C program (I also attached to the mail)

#include "KMotionDef.h"


#include "KMotionDef.h"


main()
{
int T0,T1;
int Adress0 = &ParametricCoeffs[0];
int Adress_end = &ParametricCoeffs[ParametricIndex+1];
int N = Adress_end - Adress0;
// N is the number of adresses needed in the CoordMotionBuffer. It contains N/216 segments.
T0=Time_sec();
// write N bytes of the CoordMotionBuffer to the 2nd MByte of the Flash Chip
ProgramFlash((volatile char *)ParametricCoeffs,N/sizeof(short int),FLASH_USER,""); 
T1=Time_sec();
printf ("Flash Complete Erase+Programming time = %f seconds\n",T1-T0);

}

When I execute it (after I executed my project so the CoordMotionBuffer isn't empty, I verified it and N=14688) there is no errors and no warnings, but it takes 0.000000 seconds to complete the task (shown in the consol with the "printf" command). I guess my program doesn't work because it normaly takes  0.018062 seconds to copy the 16 bytes of the example program (WriteData.c)...

Do you know why it doesn't work ? I guess it is in the ProgramFlash(...) arguments.

Thanks again,

Guillaume




Group: DynoMotion Message: 13446 From: gyelle10 Date: 7/4/2016
Subject: Re: Stand alone application
Thanks a lot for the tips!

I think it works fine (now it takes 0.284108 seconds to flash the CoordMotionBuffer).

I'm now working on the final step, which is to copy the flash memory into the CoordMotionBuffer to finally execute it in stand alone. 

Here is my C program (I attached a version to this mail : FlashToCorrdMotionBuffer.c) :

#include "KMotionDef.h"

#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash 
void SetFlashBank(volatile unsigned short *add);

main()
{
PARAMETRIC_COEFF *p=(PARAMETRIC_COEFF*)FLASHC;  // pointer to the FLASH Chip
SetFlashBank(FLASHC); // the DSP external bus is banked, this routine selects the bank for the address 
// now we can access the data 
int i;
for(i=0; i<14904; i++) //Copy contain of the flash into CoordMotionBuffer
{
ParametricCoeffs[i]=p[i+0x100000/sizeof(double)];
}
}

The program executes without warning and error, but when I execute the CoordMotionBuffer nothing happens. I executed the Buffer before I execute this program and it went well (so the 
CoordMotionBuffer was not empty when I copied it into flash) I also attached the C program that I used to flash the CoordMotionBuffer.(FlashCoordMotionBuffer.c)



Thanks in advance,

Guillaume







On Monday, July 4, 2016 2:02 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
You are defining T0 and T1 as int.  Define them as 'double', otherwise it will truncate to a whole number of seconds.

In C, you have to be very aware of data types.  It's a low-level language (one step up from assembler).

You are setting pointers (addresses) directly into 'int'.  Although the compiler allows this, it's not good practice.  Instead of doing that complicated address arithmetic, if you want to find the number of bytes to program then put:

int N = (ParametricIndex+1)*sizeof(ParametricCoeffs[0]);

Regards,
SJH





On Mon, Jul 4, 2016 at 9:28 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... [DynoMotion] included below]
Hi Tom,

I need help with my Cprogram that copy the CoordMotionBuffer to the FLASH_USER. Here is my C program (I also attached to the mail)

#include "KMotionDef.h"


#include "KMotionDef.h"


main()
{
int T0,T1;
int Adress0 = &ParametricCoeffs[0];
int Adress_end = &ParametricCoeffs[ParametricIndex+1];
int N = Adress_end - Adress0;
// N is the number of adresses needed in the CoordMotionBuffer. It contains N/216 segments.
T0=Time_sec();
// write N bytes of the CoordMotionBuffer to the 2nd MByte of the Flash Chip
ProgramFlash((volatile char *)ParametricCoeffs,N/sizeof(short int),FLASH_USER,""); 
T1=Time_sec();
printf ("Flash Complete Erase+Programming time = %f seconds\n",T1-T0);

}

When I execute it (after I executed my project so the CoordMotionBuffer isn't empty, I verified it and N=14688) there is no errors and no warnings, but it takes 0.000000 seconds to complete the task (shown in the consol with the "printf" command). I guess my program doesn't work because it normaly takes  0.018062 seconds to copy the 16 bytes of the example program (WriteData.c)...

Do you know why it doesn't work ? I guess it is in the ProgramFlash(...) arguments.

Thanks again,

Guillaume






  @@attachment@@
Group: DynoMotion Message: 13449 From: Hardy Family Date: 7/4/2016
Subject: Re: Stand alone application [2 Attachments]
Why are you adding 0x100000/sizeof(double) in the array index?  That will definitely index beyond the end of the buffer.

p is pointing directly to the data you saved, so the items will start at index 0.

I haven't done this before, but I would think that you need to do more than just copy the data to get the machine to move.  You need to call some functions which actually tell the kflop firmware how many items are in the buffer, and start the motion.

As I mentioned, C is very low level.  All you did was copy a bunch of bytes from one location to another.  There's no magic that tells it what to do with the data.

So it is very unlikely to work the way you think.  Copying the data out of the ParametricCoeffs buffer should be fine, but to actually replay the moves you should look at Tom's examples.  You will probably need to examine each item in turn, and make the appropriate coordinated motion function call(s).

Regards,
SJH


On Mon, Jul 4, 2016 at 12:46 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... included below]

Thanks a lot for the tips!

I think it works fine (now it takes 0.284108 seconds to flash the CoordMotionBuffer).

I'm now working on the final step, which is to copy the flash memory into the CoordMotionBuffer to finally execute it in stand alone. 

Here is my C program (I attached a version to this mail : FlashToCorrdMotionBuffer.c) :

#include "KMotionDef.h"

#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash 
void SetFlashBank(volatile unsigned short *add);

main()
{
PARAMETRIC_COEFF *p=(PARAMETRIC_COEFF*)FLASHC;  // pointer to the FLASH Chip
SetFlashBank(FLASHC); // the DSP external bus is banked, this routine selects the bank for the address 
// now we can access the data 
int i;
for(i=0; i<14904; i++) //Copy contain of the flash into CoordMotionBuffer
{
ParametricCoeffs[i]=p[i+0x100000/sizeof(double)];
}
}

The program executes without warning and error, but when I execute the CoordMotionBuffer nothing happens. I executed the Buffer before I execute this program and it went well (so the 
CoordMotionBuffer was not empty when I copied it into flash) I also attached the C program that I used to flash the CoordMotionBuffer.(FlashCoordMotionBuffer.c)



Thanks in advance,

Guillaume







On Monday, July 4, 2016 2:02 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
You are defining T0 and T1 as int.  Define them as 'double', otherwise it will truncate to a whole number of seconds.

In C, you have to be very aware of data types.  It's a low-level language (one step up from assembler).

You are setting pointers (addresses) directly into 'int'.  Although the compiler allows this, it's not good practice.  Instead of doing that complicated address arithmetic, if you want to find the number of bytes to program then put:

int N = (ParametricIndex+1)*sizeof(ParametricCoeffs[0]);

Regards,
SJH





On Mon, Jul 4, 2016 at 9:28 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... [DynoMotion] included below]
Hi Tom,

I need help with my Cprogram that copy the CoordMotionBuffer to the FLASH_USER. Here is my C program (I also attached to the mail)

#include "KMotionDef.h"


#include "KMotionDef.h"


main()
{
int T0,T1;
int Adress0 = &ParametricCoeffs[0];
int Adress_end = &ParametricCoeffs[ParametricIndex+1];
int N = Adress_end - Adress0;
// N is the number of adresses needed in the CoordMotionBuffer. It contains N/216 segments.
T0=Time_sec();
// write N bytes of the CoordMotionBuffer to the 2nd MByte of the Flash Chip
ProgramFlash((volatile char *)ParametricCoeffs,N/sizeof(short int),FLASH_USER,""); 
T1=Time_sec();
printf ("Flash Complete Erase+Programming time = %f seconds\n",T1-T0);

}

When I execute it (after I executed my project so the CoordMotionBuffer isn't empty, I verified it and N=14688) there is no errors and no warnings, but it takes 0.000000 seconds to complete the task (shown in the consol with the "printf" command). I guess my program doesn't work because it normaly takes  0.018062 seconds to copy the 16 bytes of the example program (WriteData.c)...

Do you know why it doesn't work ? I guess it is in the ProgramFlash(...) arguments.

Thanks again,

Guillaume







Group: DynoMotion Message: 13457 From: gyelle10 Date: 7/5/2016
Subject: Re: Stand alone application
Hello,

I was following the ReadSavedData.c example and when it access to the flashed data, it calls : " p[0+0x100000/sizeof(double)] " and it works fine when I previously flashed data with the WriteData.c example. I tried with p[0] and it finally works with my file :)

Concerning the execution of the motion with the data that I've copied back in the CoordMotionBuffer, I didn't expect to see any motion here. As I said, I execute what is in the buffer once I've copied back the data. I do it with an example that Tom gave me and it works fine when there are data :

LastCoordSystem0=&ParametricCoeffs[0];  // reset to start at beginning
ExecBuf();

Everything work fine now but I do it seperatly (I execute each thread manually). I can work on communication for real stand alone now.

Thanks for your time!

Regards,

Guillaume
 




On Monday, July 4, 2016 5:02 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Why are you adding 0x100000/sizeof(double) in the array index?  That will definitely index beyond the end of the buffer.

p is pointing directly to the data you saved, so the items will start at index 0.

I haven't done this before, but I would think that you need to do more than just copy the data to get the machine to move.  You need to call some functions which actually tell the kflop firmware how many items are in the buffer, and start the motion.

As I mentioned, C is very low level.  All you did was copy a bunch of bytes from one location to another.  There's no magic that tells it what to do with the data.

So it is very unlikely to work the way you think.  Copying the data out of the ParametricCoeffs buffer should be fine, but to actually replay the moves you should look at Tom's examples.  You will probably need to examine each item in turn, and make the appropriate coordinated motion function call(s).

Regards,
SJH


On Mon, Jul 4, 2016 at 12:46 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... included below]
Thanks a lot for the tips!

I think it works fine (now it takes 0.284108 seconds to flash the CoordMotionBuffer).

I'm now working on the final step, which is to copy the flash memory into the CoordMotionBuffer to finally execute it in stand alone. 

Here is my C program (I attached a version to this mail : FlashToCorrdMotionBuffer.c) :

#include "KMotionDef.h"

#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash 
void SetFlashBank(volatile unsigned short *add);

main()
{
PARAMETRIC_COEFF *p=(PARAMETRIC_COEFF*)FLASHC;  // pointer to the FLASH Chip
SetFlashBank(FLASHC); // the DSP external bus is banked, this routine selects the bank for the address 
// now we can access the data 
int i;
for(i=0; i<14904; i++) //Copy contain of the flash into CoordMotionBuffer
{
ParametricCoeffs[i]=p[i+0x100000/sizeof(double)];
}
}

The program executes without warning and error, but when I execute the CoordMotionBuffer nothing happens. I executed the Buffer before I execute this program and it went well (so the 
CoordMotionBuffer was not empty when I copied it into flash) I also attached the C program that I used to flash the CoordMotionBuffer.(FlashCoordMotionBuffer.c)



Thanks in advance,

Guillaume







On Monday, July 4, 2016 2:02 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
You are defining T0 and T1 as int.  Define them as 'double', otherwise it will truncate to a whole number of seconds.

In C, you have to be very aware of data types.  It's a low-level language (one step up from assembler).

You are setting pointers (addresses) directly into 'int'.  Although the compiler allows this, it's not good practice.  Instead of doing that complicated address arithmetic, if you want to find the number of bytes to program then put:

int N = (ParametricIndex+1)*sizeof(ParametricCoeffs[0]);

Regards,
SJH





On Mon, Jul 4, 2016 at 9:28 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... [DynoMotion] included below]
Hi Tom,

I need help with my Cprogram that copy the CoordMotionBuffer to the FLASH_USER. Here is my C program (I also attached to the mail)

#include "KMotionDef.h"


#include "KMotionDef.h"


main()
{
int T0,T1;
int Adress0 = &ParametricCoeffs[0];
int Adress_end = &ParametricCoeffs[ParametricIndex+1];
int N = Adress_end - Adress0;
// N is the number of adresses needed in the CoordMotionBuffer. It contains N/216 segments.
T0=Time_sec();
// write N bytes of the CoordMotionBuffer to the 2nd MByte of the Flash Chip
ProgramFlash((volatile char *)ParametricCoeffs,N/sizeof(short int),FLASH_USER,""); 
T1=Time_sec();
printf ("Flash Complete Erase+Programming time = %f seconds\n",T1-T0);

}

When I execute it (after I executed my project so the CoordMotionBuffer isn't empty, I verified it and N=14688) there is no errors and no warnings, but it takes 0.000000 seconds to complete the task (shown in the consol with the "printf" command). I guess my program doesn't work because it normaly takes  0.018062 seconds to copy the 16 bytes of the example program (WriteData.c)...

Do you know why it doesn't work ? I guess it is in the ProgramFlash(...) arguments.

Thanks again,

Guillaume









Group: DynoMotion Message: 13458 From: Hardy Family Date: 7/5/2016
Subject: Re: Stand alone application
Just to be clear, in Tom's example 'p' is a pointer to double (=8 bytes), but in your code p was a pointer to PARAMETRIC_COEFF which is 216 bytes.  When indexing arrays, the C compiler works out the byte address by multiplying the index by the size of the pointed-to items.

Also, in Tom's example p pointed to the start of the flash chip (0x90000000) but your code set p to the start of the next meg (0x90100000).

So, in Tom's code the compiler works out the addess using

0x90000000 + sizeof(double) * (0x100000/sizeof(double)) = 0x90100000

whereas your original code would compute

0x90100000 + sizeof(PARAMETRIC_COEFF) * (i + (0x100000/sizeof(double))) = 0x91C00000 (if i==0)

which is outside the valid address range of the flash.

Regards,
SJH

On Tue, Jul 5, 2016 at 6:37 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hello,

I was following the ReadSavedData.c example and when it access to the flashed data, it calls : " p[0+0x100000/sizeof(double)] " and it works fine when I previously flashed data with the WriteData.c example. I tried with p[0] and it finally works with my file :)

Concerning the execution of the motion with the data that I've copied back in the CoordMotionBuffer, I didn't expect to see any motion here. As I said, I execute what is in the buffer once I've copied back the data. I do it with an example that Tom gave me and it works fine when there are data :

LastCoordSystem0=&ParametricCoeffs[0];  // reset to start at beginning
ExecBuf();

Everything work fine now but I do it seperatly (I execute each thread manually). I can work on communication for real stand alone now.

Thanks for your time!

Regards,

Guillaume
 




On Monday, July 4, 2016 5:02 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Why are you adding 0x100000/sizeof(double) in the array index?  That will definitely index beyond the end of the buffer.

p is pointing directly to the data you saved, so the items will start at index 0.

I haven't done this before, but I would think that you need to do more than just copy the data to get the machine to move.  You need to call some functions which actually tell the kflop firmware how many items are in the buffer, and start the motion.

As I mentioned, C is very low level.  All you did was copy a bunch of bytes from one location to another.  There's no magic that tells it what to do with the data.

So it is very unlikely to work the way you think.  Copying the data out of the ParametricCoeffs buffer should be fine, but to actually replay the moves you should look at Tom's examples.  You will probably need to examine each item in turn, and make the appropriate coordinated motion function call(s).

Regards,
SJH


On Mon, Jul 4, 2016 at 12:46 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... included below]
Thanks a lot for the tips!

I think it works fine (now it takes 0.284108 seconds to flash the CoordMotionBuffer).

I'm now working on the final step, which is to copy the flash memory into the CoordMotionBuffer to finally execute it in stand alone. 

Here is my C program (I attached a version to this mail : FlashToCorrdMotionBuffer.c) :

#include "KMotionDef.h"

#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash 
void SetFlashBank(volatile unsigned short *add);

main()
{
PARAMETRIC_COEFF *p=(PARAMETRIC_COEFF*)FLASHC;  // pointer to the FLASH Chip
SetFlashBank(FLASHC); // the DSP external bus is banked, this routine selects the bank for the address 
// now we can access the data 
int i;
for(i=0; i<14904; i++) //Copy contain of the flash into CoordMotionBuffer
{
ParametricCoeffs[i]=p[i+0x100000/sizeof(double)];
}
}

The program executes without warning and error, but when I execute the CoordMotionBuffer nothing happens. I executed the Buffer before I execute this program and it went well (so the 
CoordMotionBuffer was not empty when I copied it into flash) I also attached the C program that I used to flash the CoordMotionBuffer.(FlashCoordMotionBuffer.c)



Thanks in advance,

Guillaume







On Monday, July 4, 2016 2:02 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
You are defining T0 and T1 as int.  Define them as 'double', otherwise it will truncate to a whole number of seconds.

In C, you have to be very aware of data types.  It's a low-level language (one step up from assembler).

You are setting pointers (addresses) directly into 'int'.  Although the compiler allows this, it's not good practice.  Instead of doing that complicated address arithmetic, if you want to find the number of bytes to program then put:

int N = (ParametricIndex+1)*sizeof(ParametricCoeffs[0]);

Regards,
SJH





On Mon, Jul 4, 2016 at 9:28 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... [DynoMotion] included below]
Hi Tom,

I need help with my Cprogram that copy the CoordMotionBuffer to the FLASH_USER. Here is my C program (I also attached to the mail)

#include "KMotionDef.h"


#include "KMotionDef.h"


main()
{
int T0,T1;
int Adress0 = &ParametricCoeffs[0];
int Adress_end = &ParametricCoeffs[ParametricIndex+1];
int N = Adress_end - Adress0;
// N is the number of adresses needed in the CoordMotionBuffer. It contains N/216 segments.
T0=Time_sec();
// write N bytes of the CoordMotionBuffer to the 2nd MByte of the Flash Chip
ProgramFlash((volatile char *)ParametricCoeffs,N/sizeof(short int),FLASH_USER,""); 
T1=Time_sec();
printf ("Flash Complete Erase+Programming time = %f seconds\n",T1-T0);

}

When I execute it (after I executed my project so the CoordMotionBuffer isn't empty, I verified it and N=14688) there is no errors and no warnings, but it takes 0.000000 seconds to complete the task (shown in the consol with the "printf" command). I guess my program doesn't work because it normaly takes  0.018062 seconds to copy the 16 bytes of the example program (WriteData.c)...

Do you know why it doesn't work ? I guess it is in the ProgramFlash(...) arguments.

Thanks again,

Guillaume










Group: DynoMotion Message: 13460 From: David Strip Date: 7/5/2016
Subject: Re: Stand alone application
On 7/5/2016 8:24 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:

Also, in Tom's example p pointed to the start of the flash chip (0x90000000) but your code set p to the start of the next meg (0x90100000).

So, in Tom's code the compiler works out the addess using

0x90000000 + sizeof(double) * (0x100000/sizeof(double)) = 0x90100000

This is what I expected to see when I looked at the code, but in the  433 distribution of ReadSavedData.c
#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash
void SetFlashBank(volatile unsigned short *add);

main()
{
    double *p=(double*)FLASHC;  // pointer to the FLASH Chip

So in fact p already points to the user space, yet when accessed, the code is still adding (0x100000/sizeof(double)) -
    printf("Saved 0 1 2 = %f %f %X\n",p[0+0x100000/sizeof(double)],
                                      p[1+0x100000/sizeof(double)],
                                      *(int*)(&p[2+0x100000/sizeof(double)]));
So now I'm still confused how this can work.

--
Group: DynoMotion Message: 13463 From: Hardy Family Date: 7/5/2016
Subject: Re: Stand alone application
I was looking at an older version of that sample.  But if it works, it is only by chance: the flash chip is 2MB so addresses in the same chip select region will wrap around many times (because the chip will only see the low 21 bits of address).  Also, the low and high MB might happen to have the same data e.g. if the write program was ever run for both the low and high half.  You would need to know the history of that chip.  Try writing different data and see if it still works. 

Still, adding 1MB/8 to the index looks like an oversight (maybe left over from the previous version which didn't set the base address to the second half?)

Regards,
SJH


On Tue, Jul 5, 2016 at 7:36 AM, David Strip David@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

On 7/5/2016 8:24 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:

Also, in Tom's example p pointed to the start of the flash chip (0x90000000) but your code set p to the start of the next meg (0x90100000).

So, in Tom's code the compiler works out the addess using

0x90000000 + sizeof(double) * (0x100000/sizeof(double)) = 0x90100000

This is what I expected to see when I looked at the code, but in the  433 distribution of ReadSavedData.c
#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash
void SetFlashBank(volatile unsigned short *add);

main()
{
    double *p=(double*)FLASHC;  // pointer to the FLASH Chip

So in fact p already points to the user space, yet when accessed, the code is still adding (0x100000/sizeof(double)) -
    printf("Saved 0 1 2 = %f %f %X\n",p[0+0x100000/sizeof(double)],
                                      p[1+0x100000/sizeof(double)],
                                      *(int*)(&p[2+0x100000/sizeof(double)]));
So now I'm still confused how this can work.

--


Group: DynoMotion Message: 13464 From: gyelle10 Date: 7/5/2016
Subject: Re: Stand alone application
Hello,

How can I adjust the speed in stand alone ? Is there a way to use the console command SetFRO within a C program ? Or can I change a Step/Dir setting that could change the feedrate ? I looked for these option and I didn't find many information... 

I can change either specific speed or relative speed (FRO), it doesn't mather.

Thanks in advance,

Guillaume


On Tuesday, July 5, 2016 12:14 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
I was looking at an older version of that sample.  But if it works, it is only by chance: the flash chip is 2MB so addresses in the same chip select region will wrap around many times (because the chip will only see the low 21 bits of address).  Also, the low and high MB might happen to have the same data e.g. if the write program was ever run for both the low and high half.  You would need to know the history of that chip.  Try writing different data and see if it still works. 

Still, adding 1MB/8 to the index looks like an oversight (maybe left over from the previous version which didn't set the base address to the second half?)

Regards,
SJH


On Tue, Jul 5, 2016 at 7:36 AM, David Strip David@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
On 7/5/2016 8:24 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:

Also, in Tom's example p pointed to the start of the flash chip (0x90000000) but your code set p to the start of the next meg (0x90100000).

So, in Tom's code the compiler works out the addess using

0x90000000 + sizeof(double) * (0x100000/sizeof(double)) = 0x90100000

This is what I expected to see when I looked at the code, but in the  433 distribution of ReadSavedData.c
#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash
void SetFlashBank(volatile unsigned short *add);

main()
{
    double *p=(double*)FLASHC;  // pointer to the FLASH Chip

So in fact p already points to the user space, yet when accessed, the code is still adding (0x100000/sizeof(double)) -
    printf("Saved 0 1 2 = %f %f %X\n",p[0+0x100000/sizeof(double)],
                                      p[1+0x100000/sizeof(double)],
                                      *(int*)(&p[2+0x100000/sizeof(double)]));
So now I'm still confused how this can work.

--



Group: DynoMotion Message: 13468 From: Hardy Family Date: 7/5/2016
Subject: Re: Stand alone application
Yes, look in KMotionDef.h for the SetFRO() function.

Also search the Yahoo group.  I know the interface to this is not the best, but it is worth browsing.

Regards,
SJH


On Tue, Jul 5, 2016 at 1:35 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hello,

How can I adjust the speed in stand alone ? Is there a way to use the console command SetFRO within a C program ? Or can I change a Step/Dir setting that could change the feedrate ? I looked for these option and I didn't find many information... 

I can change either specific speed or relative speed (FRO), it doesn't mather.

Thanks in advance,

Guillaume


On Tuesday, July 5, 2016 12:14 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
I was looking at an older version of that sample.  But if it works, it is only by chance: the flash chip is 2MB so addresses in the same chip select region will wrap around many times (because the chip will only see the low 21 bits of address).  Also, the low and high MB might happen to have the same data e.g. if the write program was ever run for both the low and high half.  You would need to know the history of that chip.  Try writing different data and see if it still works. 

Still, adding 1MB/8 to the index looks like an oversight (maybe left over from the previous version which didn't set the base address to the second half?)

Regards,
SJH


On Tue, Jul 5, 2016 at 7:36 AM, David Strip David@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
On 7/5/2016 8:24 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:

Also, in Tom's example p pointed to the start of the flash chip (0x90000000) but your code set p to the start of the next meg (0x90100000).

So, in Tom's code the compiler works out the addess using

0x90000000 + sizeof(double) * (0x100000/sizeof(double)) = 0x90100000

This is what I expected to see when I looked at the code, but in the  433 distribution of ReadSavedData.c
#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash
void SetFlashBank(volatile unsigned short *add);

main()
{
    double *p=(double*)FLASHC;  // pointer to the FLASH Chip

So in fact p already points to the user space, yet when accessed, the code is still adding (0x100000/sizeof(double)) -
    printf("Saved 0 1 2 = %f %f %X\n",p[0+0x100000/sizeof(double)],
                                      p[1+0x100000/sizeof(double)],
                                      *(int*)(&p[2+0x100000/sizeof(double)]));
So now I'm still confused how this can work.

--




Group: DynoMotion Message: 13469 From: Tom Kerekes Date: 7/5/2016
Subject: Re: Stand alone application

Hi Guillaume,

You are correct the coding in the ReadSavedData.c example is wrong.  It works because the Flash Bank was being set correctly.  Where the words were being accessed the address was off by 0x100000 but because only the bottom 14 bits of the address are used when reading Flash words (the upper bits are determined by the bank) it wouldn't matter.

Note when reading out large amounts of Flash data you must be sure to set the Bank whenever you cross a 16KByte boundary.

A corrected example is below.

Regards

TK


#include "KMotionDef.h"

void SetFlashBank(volatile unsigned short *add);

main()
{
    double *p=(double*)FLASH_USER;  // pointer to the FLASH Chip
       
    SetFlashBank(p); // the DSP external bus is banked, this routine selects the bank for the address
    // now we can access the data
    printf("Saved 0 1 2 = %f %f next word = %X\n",p[0],p[1],*(int*)(&p[2]));
}


On 7/5/2016 6:37 AM, gyelle10@... [DynoMotion] wrote:
 
Hello,

I was following the ReadSavedData.c example and when it access to the flashed data, it calls : " p[0+0x100000/sizeof(double)] " and it works fine when I previously flashed data with the WriteData.c example. I tried with p[0] and it finally works with my file :)
Concerning the execution of the motion with the data that I've copied back in the CoordMotionBuffer, I didn't expect to see any motion here. As I said, I execute what is in the buffer once I've copied back the data. I do it with an example that Tom gave me and it works fine when there are data :
LastCoordSystem0=&ParametricCoeffs[0];  // reset to start at beginning
ExecBuf();

Everything work fine now but I do it seperatly (I execute each thread manually). I can work on communication for real stand alone now.

Thanks for your time!

Regards,

Guillaume
 




On Monday, July 4, 2016 5:02 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Why are you adding 0x100000/sizeof(double) in the array index?  That will definitely index beyond the end of the buffer.

p is pointing directly to the data you saved, so the items will start at index 0.

I haven't done this before, but I would think that you need to do more than just copy the data to get the machine to move.  You need to call some functions which actually tell the kflop firmware how many items are in the buffer, and start the motion.

As I mentioned, C is very low level.  All you did was copy a bunch of bytes from one location to another.  There's no magic that tells it what to do with the data.

So it is very unlikely to work the way you think.  Copying the data out of the ParametricCoeffs buffer should be fine, but to actually replay the moves you should look at Tom's examples.  You will probably need to examine each item in turn, and make the appropriate coordinated motion function call(s).

Regards,
SJH


On Mon, Jul 4, 2016 at 12:46 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... included below]
Thanks a lot for the tips!

I think it works fine (now it takes 0.284108 seconds to flash the CoordMotionBuffer).

I'm now working on the final step, which is to copy the flash memory into the CoordMotionBuffer to finally execute it in stand alone. 

Here is my C program (I attached a version to this mail : FlashToCorrdMotionBuffer.c) :

#include "KMotionDef.h"

#define FLASHC ((volatile char *)0x90100000)  //  2nd Meg of Flash 
void SetFlashBank(volatile unsigned short *add);

main()
{
PARAMETRIC_COEFF *p=(PARAMETRIC_COEFF*)FLASHC;  // pointer to the FLASH Chip
SetFlashBank(FLASHC); // the DSP external bus is banked, this routine selects the bank for the address 
// now we can access the data 
int i;
for(i=0; i<14904; i++) //Copy contain of the flash into CoordMotionBuffer
{
ParametricCoeffs[i]=p[i+0x100000/sizeof(double)];
}
}

The program executes without warning and error, but when I execute the CoordMotionBuffer nothing happens. I executed the Buffer before I execute this program and it went well (so the 
CoordMotionBuffer was not empty when I copied it into flash) I also attached the C program that I used to flash the CoordMotionBuffer.(FlashCoordMotionBuffer.c)



Thanks in advance,

Guillaume







On Monday, July 4, 2016 2:02 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
You are defining T0 and T1 as int.  Define them as 'double', otherwise it will truncate to a whole number of seconds.

In C, you have to be very aware of data types.  It's a low-level language (one step up from assembler).

You are setting pointers (addresses) directly into 'int'.  Although the compiler allows this, it's not good practice.  Instead of doing that complicated address arithmetic, if you want to find the number of bytes to program then put:

int N = (ParametricIndex+1)*sizeof(ParametricCoeffs[0]);

Regards,
SJH





On Mon, Jul 4, 2016 at 9:28 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
[Attachment(s) from gyelle10@... [DynoMotion] included below]
Hi Tom,

I need help with my Cprogram that copy the CoordMotionBuffer to the FLASH_USER. Here is my C program (I also attached to the mail)

#include "KMotionDef.h"


#include "KMotionDef.h"


main()
{
int T0,T1;
int Adress0 = &ParametricCoeffs[0];
int Adress_end = &ParametricCoeffs[ParametricIndex+1];
int N = Adress_end - Adress0;
// N is the number of adresses needed in the CoordMotionBuffer. It contains N/216 segments.
T0=Time_sec();
// write N bytes of the CoordMotionBuffer to the 2nd MByte of the Flash Chip
ProgramFlash((volatile char *)ParametricCoeffs,N/sizeof(short int),FLASH_USER,""); 
T1=Time_sec();
printf ("Flash Complete Erase+Programming time = %f seconds\n",T1-T0);

}

When I execute it (after I executed my project so the CoordMotionBuffer isn't empty, I verified it and N=14688) there is no errors and no warnings, but it takes 0.000000 seconds to complete the task (shown in the consol with the "printf" command). I guess my program doesn't work because it normaly takes  0.018062 seconds to copy the 16 bytes of the example program (WriteData.c)...

Do you know why it doesn't work ? I guess it is in the ProgramFlash(...) arguments.

Thanks again,

Guillaume










Group: DynoMotion Message: 13492 From: gyelle10 Date: 7/7/2016
Subject: Re: Stand alone application
Hi all,

Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

 Here is how I figured out my stand alone application :

1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

Guillaume

 




On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume





Group: DynoMotion Message: 13493 From: Hardy Family Date: 7/7/2016
Subject: Re: Stand alone application
One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

Code something like this might work:

double fro = 1.;
SetFRO(fro);
for (;;) {
  double c = get_current_feed_rate();
  double d = get_desired_max_feed_rate();
  if (c > d) {  // slow down
     fro *= d/c;
     SetFRO(fro);
  }
  else { // speed up
     if (c > 0.)
       fro *= d/c;
       if (fro > 1.) fro = 1.;
     }
     else
         fro = 1.;
     SetFRO(fro);
  }
  WaitNextTimeSlice();
}

Please report back whether this works; I might want to use it myself one day.

Regards,
SJH


On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi all,

Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

 Here is how I figured out my stand alone application :

1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

Guillaume

 




On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume






Group: DynoMotion Message: 13495 From: Hardy Family Date: 7/7/2016
Subject: Re: Stand alone application
PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

As with any feedback control, you need to consider stability.

One way to help might be to limit the change in FRO at any step.  So instead of

  fro *= d/c;

try something like

  newfro = fro * d/c;
  if (newfro < fro * 0.995) fro *= 0.995;
  else if (newfro > fro * 1.005) fro *= 1.005;
  else fro = newfro;

Regards,
SJH


On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

Code something like this might work:

double fro = 1.;
SetFRO(fro);
for (;;) {
  double c = get_current_feed_rate();
  double d = get_desired_max_feed_rate();
  if (c > d) {  // slow down
     fro *= d/c;
     SetFRO(fro);
  }
  else { // speed up
     if (c > 0.)
       fro *= d/c;
       if (fro > 1.) fro = 1.;
     }
     else
         fro = 1.;
     SetFRO(fro);
  }
  WaitNextTimeSlice();
}

Please report back whether this works; I might want to use it myself one day.

Regards,
SJH


On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi all,

Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

 Here is how I figured out my stand alone application :

1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

Guillaume

 




On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume







Group: DynoMotion Message: 13496 From: gyelle10 Date: 7/7/2016
Subject: Re: Stand alone application
Hi SJH,

I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

Guillaume
 


Sent from Yahoo Mail. Get the app


On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

As with any feedback control, you need to consider stability.

One way to help might be to limit the change in FRO at any step.  So instead of

  fro *= d/c;

try something like

  newfro = fro * d/c;
  if (newfro < fro * 0.995) fro *= 0.995;
  else if (newfro > fro * 1.005) fro *= 1.005;
  else fro = newfro;

Regards,
SJH


On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

Code something like this might work:

double fro = 1.;
SetFRO(fro);
for (;;) {
  double c = get_current_feed_rate();
  double d = get_desired_max_feed_rate();
  if (c > d) {  // slow down
     fro *= d/c;
     SetFRO(fro);
  }
  else { // speed up
     if (c > 0.)
       fro *= d/c;
       if (fro > 1.) fro = 1.;
     }
     else
         fro = 1.;
     SetFRO(fro);
  }
  WaitNextTimeSlice();
}

Please report back whether this works; I might want to use it myself one day.

Regards,
SJH


On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi all,

Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

 Here is how I figured out my stand alone application :

1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

Guillaume

 




On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume









Group: DynoMotion Message: 13497 From: Hardy Family Date: 7/7/2016
Subject: Re: Stand alone application
I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

Regards,
SJH


On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

Guillaume
 


Sent from Yahoo Mail. Get the app


On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

As with any feedback control, you need to consider stability.

One way to help might be to limit the change in FRO at any step.  So instead of

  fro *= d/c;

try something like

  newfro = fro * d/c;
  if (newfro < fro * 0.995) fro *= 0.995;
  else if (newfro > fro * 1.005) fro *= 1.005;
  else fro = newfro;

Regards,
SJH


On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

Code something like this might work:

double fro = 1.;
SetFRO(fro);
for (;;) {
  double c = get_current_feed_rate();
  double d = get_desired_max_feed_rate();
  if (c > d) {  // slow down
     fro *= d/c;
     SetFRO(fro);
  }
  else { // speed up
     if (c > 0.)
       fro *= d/c;
       if (fro > 1.) fro = 1.;
     }
     else
         fro = 1.;
     SetFRO(fro);
  }
  WaitNextTimeSlice();
}

Please report back whether this works; I might want to use it myself one day.

Regards,
SJH


On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi all,

Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

 Here is how I figured out my stand alone application :

1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

Guillaume

 




On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume










Group: DynoMotion Message: 13498 From: Tom Kerekes Date: 7/7/2016
Subject: Re: Stand alone application

Hi Guillaume,

Trying to change accelerations and velocities after he motion has already been planned is very difficult.  Trajectory Planning is very complex considering the desired feedrates with all the velocity/acceleration constraints of all the axes involved as well as the curvature of the path and look ahead of curvature and constraints.  KMotionCNC uses the parameters set in the Trajectory Planner not the KFLOP settings to do the planning.  See:

http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk

A simple analogy I like to use is to imagine planning a trajectory for your car to accelerate to 60MPH in 10 seconds and then cruise at 60MPH.  If you change your mind and decide to go 120MPH by running the Trajectory twice as fast, the result will be accelerating to 120MPH in 5 seconds which probably isn't possible (requires 4X the acceleration).  Similarly to go 30MPH would result in a 20 second acceleration which wouldn't fail but would be highly sub-optimal.

For simple paths that are relatively slow and constant speed where accelerations aren't critical it may work ok.  If I would have known you wanted to do dynamic acceleration and velocity I would have pushed you more in the direction of doing the Trajectory Planning in KFLOP (Although not nearly as capable as the PC Trajectory Planner).

Anyway the current instantaneous commanded feedrate can be easily computed within KFLOP.  See the VelocityToPWM.c example which controls a PWM output proportional to the current xy feedrate.

HTH

Regards

TK



On 7/7/2016 11:02 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
 
I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

Regards,
SJH


On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi SJH,

I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

Guillaume
 


Sent from Yahoo Mail. Get the app


On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

As with any feedback control, you need to consider stability.

One way to help might be to limit the change in FRO at any step.  So instead of

  fro *= d/c;

try something like

  newfro = fro * d/c;
  if (newfro < fro * 0.995) fro *= 0.995;
  else if (newfro > fro * 1.005) fro *= 1.005;
  else fro = newfro;

Regards,
SJH


On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

Code something like this might work:

double fro = 1.;
SetFRO(fro);
for (;;) {
  double c = get_current_feed_rate();
  double d = get_desired_max_feed_rate();
  if (c > d) {  // slow down
     fro *= d/c;
     SetFRO(fro);
  }
  else { // speed up
     if (c > 0.)
       fro *= d/c;
       if (fro > 1.) fro = 1.;
     }
     else
         fro = 1.;
     SetFRO(fro);
  }
  WaitNextTimeSlice();
}

Please report back whether this works; I might want to use it myself one day.

Regards,
SJH


On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi all,

Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

 Here is how I figured out my stand alone application :

1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

Guillaume

 




On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.


(Message over 64 KB, truncated)
Group: DynoMotion Message: 13499 From: Hardy Family Date: 7/7/2016
Subject: Re: Stand alone application
Hi Tom,

I can't find that VelocityToPWM sample (at least not in 433q).

I would think that controlling the FRO to create a "speed limit" would be just as good as re-planning the trajectory.  Even though accelerations are stretched out by the square of the speed ratio, it's not important if the max speed is being "clamped", since with constant speed (over a linear segment) the accelerations are zero by definition.

Regards,
SJH


On Thu, Jul 7, 2016 at 11:48 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi Guillaume,

Trying to change accelerations and velocities after he motion has already been planned is very difficult.  Trajectory Planning is very complex considering the desired feedrates with all the velocity/acceleration constraints of all the axes involved as well as the curvature of the path and look ahead of curvature and constraints.  KMotionCNC uses the parameters set in the Trajectory Planner not the KFLOP settings to do the planning.  See:

http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk

A simple analogy I like to use is to imagine planning a trajectory for your car to accelerate to 60MPH in 10 seconds and then cruise at 60MPH.  If you change your mind and decide to go 120MPH by running the Trajectory twice as fast, the result will be accelerating to 120MPH in 5 seconds which probably isn't possible (requires 4X the acceleration).  Similarly to go 30MPH would result in a 20 second acceleration which wouldn't fail but would be highly sub-optimal.

For simple paths that are relatively slow and constant speed where accelerations aren't critical it may work ok.  If I would have known you wanted to do dynamic acceleration and velocity I would have pushed you more in the direction of doing the Trajectory Planning in KFLOP (Although not nearly as capable as the PC Trajectory Planner).

Anyway the current instantaneous commanded feedrate can be easily computed within KFLOP.  See the VelocityToPWM.c example which controls a PWM output proportional to the current xy feedrate.

HTH

Regards

TK



On 7/7/2016 11:02 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
 
I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

Regards,
SJH


On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi SJH,

I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

Guillaume
 


Sent from Yahoo Mail. Get the app


On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

As with any feedback control, you need to consider stability.

One way to help might be to limit the change in FRO at any step.  So instead of

  fro *= d/c;

try something like

  newfro = fro * d/c;
  if (newfro < fro * 0.995) fro *= 0.995;
  else if (newfro > fro * 1.005) fro *= 1.005;
  else fro = newfro;

Regards,
SJH


On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

Code something like this might work:

double fro = 1.;
SetFRO(fro);
for (;;) {
  double c = get_current_feed_rate();
  double d = get_desired_max_feed_rate();
  if (c > d) {  // slow down
     fro *= d/c;
     SetFRO(fro);
  }
  else { // speed up
     if (c > 0.)
       fro *= d/c;
       if (fro > 1.) fro = 1.;
     }
     else
         fro = 1.;
     SetFRO(fro);
  }
  WaitNextTimeSlice();
}

Please report back whether this works; I might want to use it myself one day.

Regards,
SJH


On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 
Hi all,

Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

 Here is how I figured out my stand alone application :

1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

Guillaume

 




On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


 
Hi Guillaume,
I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

But for stand alone operation I see two basic approaches:
#1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
#2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
HTH
Regards
TK





On 6/16/2016 10:55 AM, gyelle10@... [DynoMotion] wrote:
 
 Hello Morray

Thank you for fast support !

I installed KMotion and had a look at the example files but still not very deep.

Using a computer running Windows would have been the best solution but yes, there is allready a PLC controlling other functions and other machines so I'll need flashe the code and control it in stand alone.

Concerning uploading new code it can be done by connecting computer directly. I won't have to change the code very often so it is okay to stop the application. Ideally, I would upload a couple of GCode project (converted into coordinated motion) like circles, squares, ellipse, etc, and once it is uploaded, I would execute only the circle, or only the square with an external command. Do you think it is possible ?

Guillaume












Group: DynoMotion Message: 13501 From: Tom Kerekes Date: 7/7/2016
Subject: Re: Stand alone application
Attachments :

    Here is the VelocityToPWM.c example attached.

    Regards

    TK


    On 7/7/2016 12:16 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    Hi Tom,

    I can't find that VelocityToPWM sample (at least not in 433q).

    I would think that controlling the FRO to create a "speed limit" would be just as good as re-planning the trajectory.  Even though accelerations are stretched out by the square of the speed ratio, it's not important if the max speed is being "clamped", since with constant speed (over a linear segment) the accelerations are zero by definition.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 11:48 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     

    Hi Guillaume,

    Trying to change accelerations and velocities after he motion has already been planned is very difficult.  Trajectory Planning is very complex considering the desired feedrates with all the velocity/acceleration constraints of all the axes involved as well as the curvature of the path and look ahead of curvature and constraints.  KMotionCNC uses the parameters set in the Trajectory Planner not the KFLOP settings to do the planning.  See:

    http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk

    A simple analogy I like to use is to imagine planning a trajectory for your car to accelerate to 60MPH in 10 seconds and then cruise at 60MPH.  If you change your mind and decide to go 120MPH by running the Trajectory twice as fast, the result will be accelerating to 120MPH in 5 seconds which probably isn't possible (requires 4X the acceleration).  Similarly to go 30MPH would result in a 20 second acceleration which wouldn't fail but would be highly sub-optimal.

    For simple paths that are relatively slow and constant speed where accelerations aren't critical it may work ok.  If I would have known you wanted to do dynamic acceleration and velocity I would have pushed you more in the direction of doing the Trajectory Planning in KFLOP (Although not nearly as capable as the PC Trajectory Planner).

    Anyway the current instantaneous commanded feedrate can be easily computed within KFLOP.  See the VelocityToPWM.c example which controls a PWM output proportional to the current xy feedrate.

    HTH

    Regards

    TK



    On 7/7/2016 11:02 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

    There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi SJH,

    I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
    Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

    Guillaume
     


    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

    As with any feedback control, you need to consider stability.

    One way to help might be to limit the change in FRO at any step.  So instead of

      fro *= d/c;

    try something like

      newfro = fro * d/c;
      if (newfro < fro * 0.995) fro *= 0.995;
      else if (newfro > fro * 1.005) fro *= 1.005;
      else fro = newfro;

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
    One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

    Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

    Code something like this might work:

    double fro = 1.;
    SetFRO(fro);
    for (;;) {
      double c = get_current_feed_rate();
      double d = get_desired_max_feed_rate();
      if (c > d) {  // slow down
         fro *= d/c;
         SetFRO(fro);
      }
      else { // speed up
         if (c > 0.)
           fro *= d/c;
           if (fro > 1.) fro = 1.;
         }
         else
             fro = 1.;
         SetFRO(fro);
      }
      WaitNextTimeSlice();
    }

    Please report back whether this works; I might want to use it myself one day.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi all,

    Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

     Here is how I figured out my stand alone application :

    1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

    2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

    3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

    4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

    Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

    What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

    Guillaume

     




    On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Hi Guillaume,
    I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

    But for stand alone operation I see two basic approaches:
    #1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
    I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
    You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
    #2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
    Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
    In either case you can control PWM for the Laser Power with

    (Message over 64 KB, truncated)
    Group: DynoMotion Message: 13502 From: Tom Kerekes Date: 7/7/2016
    Subject: Re: Stand alone application

    Looks like Yahoo disallowed the attachment.  it is included in V4.33 and pasted below.

    Regards

    TK

    #include "KMotionDef.h"

    // Drives PWM output proportional to current Speed

    #define FACTOR 0.01f  // factor to convert speed to PWM counts

    main()
    {
        float Speed;
        int PWM;
       
        SetBitDirection(26,1);          // define bit as an output
        FPGA(IO_PWMS_PRESCALE) = 13;      // divide clock by 13 (5 KHz)
        FPGA(IO_PWMS) = 0;                 // PWM off
        FPGA(IO_PWMS+1) = 1;              // Enable

        for(;;)
        {
            WaitNextTimeSlice();
            // compute xy speed in counts/sec
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel);
            PWM = (int)(Speed * FACTOR);     // scale PWM
            if (PWM>255) PWM=255;            // limit to max PWM
            FPGA(IO_PWMS) = PWM;             // output PWM
        }
    }


    On 7/7/2016 12:28 PM, Tom Kerekes tk@... [DynoMotion] wrote:
     

    Here is the VelocityToPWM.c example attached.

    Regards

    TK


    On 7/7/2016 12:16 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    Hi Tom,

    I can't find that VelocityToPWM sample (at least not in 433q).

    I would think that controlling the FRO to create a "speed limit" would be just as good as re-planning the trajectory.  Even though accelerations are stretched out by the square of the speed ratio, it's not important if the max speed is being "clamped", since with constant speed (over a linear segment) the accelerations are zero by definition.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 11:48 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     

    Hi Guillaume,

    Trying to change accelerations and velocities after he motion has already been planned is very difficult.  Trajectory Planning is very complex considering the desired feedrates with all the velocity/acceleration constraints of all the axes involved as well as the curvature of the path and look ahead of curvature and constraints.  KMotionCNC uses the parameters set in the Trajectory Planner not the KFLOP settings to do the planning.  See:

    http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk

    A simple analogy I like to use is to imagine planning a trajectory for your car to accelerate to 60MPH in 10 seconds and then cruise at 60MPH.  If you change your mind and decide to go 120MPH by running the Trajectory twice as fast, the result will be accelerating to 120MPH in 5 seconds which probably isn't possible (requires 4X the acceleration).  Similarly to go 30MPH would result in a 20 second acceleration which wouldn't fail but would be highly sub-optimal.

    For simple paths that are relatively slow and constant speed where accelerations aren't critical it may work ok.  If I would have known you wanted to do dynamic acceleration and velocity I would have pushed you more in the direction of doing the Trajectory Planning in KFLOP (Although not nearly as capable as the PC Trajectory Planner).

    Anyway the current instantaneous commanded feedrate can be easily computed within KFLOP.  See the VelocityToPWM.c example which controls a PWM output proportional to the current xy feedrate.

    HTH

    Regards

    TK



    On 7/7/2016 11:02 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

    There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi SJH,

    I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
    Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

    Guillaume
     


    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

    As with any feedback control, you need to consider stability.

    One way to help might be to limit the change in FRO at any step.  So instead of

      fro *= d/c;

    try something like

      newfro = fro * d/c;
      if (newfro < fro * 0.995) fro *= 0.995;
      else if (newfro > fro * 1.005) fro *= 1.005;
      else fro = newfro;

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
    One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

    Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

    Code something like this might work:

    double fro = 1.;
    SetFRO(fro);
    for (;;) {
      double c = get_current_feed_rate();
      double d = get_desired_max_feed_rate();
      if (c > d) {  // slow down
         fro *= d/c;
         SetFRO(fro);
      }
      else { // speed up
         if (c > 0.)
           fro *= d/c;
           if (fro > 1.) fro = 1.;
         }
         else
             fro = 1.;
         SetFRO(fro);
      }
      WaitNextTimeSlice();
    }

    Please report back whether this works; I might want to use it myself one day.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi all,

    Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

     Here is how I figured out my stand alone application :

    1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

    2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

    3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

    4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

    Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

    What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

    Guillaume

     




    On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Hi Guillaume,
    I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

    But for stand alone operation I see two basic approaches:
    #1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
    I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
    You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
    #2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the

    (Message over 64 KB, truncated)
    Group: DynoMotion Message: 13505 From: gyelle10 Date: 7/7/2016
    Subject: Re: Stand alone application
    Hello Tom and SJH,

    I'm trying to figure out how what are the units of the speed ... when I printf the speed defined by :
     
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel); 

    and I take a sample every second, the result is -536870912. I don't understand how this value can be negative since it is the result of a sqrtf... I've looked in the KMotionDef.h and in  http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk
    but I didn't find the units. (My axis resolution is 3200 step/ rev and 40,33 mm/rev and the speed reference was 8000mm/min)


    Guillaume

    PS : I need this information to try SJH's idea. To do so I need a speed reference.





    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 3:36 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Looks like Yahoo disallowed the attachment.  it is included in V4.33 and pasted below.
    Regards
    TK
    #include "KMotionDef.h"

    // Drives PWM output proportional to current Speed

    #define FACTOR 0.01f  // factor to convert speed to PWM counts

    main()
    {
        float Speed;
        int PWM;
       
        SetBitDirection(26,1);          // define bit as an output
        FPGA(IO_PWMS_PRESCALE) = 13;      // divide clock by 13 (5 KHz)
        FPGA(IO_PWMS) = 0;                 // PWM off
        FPGA(IO_PWMS+1) = 1;              // Enable

        for(;;)
        {
            WaitNextTimeSlice();
            // compute xy speed in counts/sec
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel);
            PWM = (int)(Speed * FACTOR);     // scale PWM
            if (PWM>255) PWM=255;            // limit to max PWM
            FPGA(IO_PWMS) = PWM;             // output PWM
        }
    }


    On 7/7/2016 12:28 PM, Tom Kerekes tk@... [DynoMotion] wrote:
     
    Here is the VelocityToPWM.c example attached.
    Regards
    TK

    On 7/7/2016 12:16 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    Hi Tom,

    I can't find that VelocityToPWM sample (at least not in 433q).

    I would think that controlling the FRO to create a "speed limit" would be just as good as re-planning the trajectory.  Even though accelerations are stretched out by the square of the speed ratio, it's not important if the max speed is being "clamped", since with constant speed (over a linear segment) the accelerations are zero by definition.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 11:48 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi Guillaume,
    Trying to change accelerations and velocities after he motion has already been planned is very difficult.  Trajectory Planning is very complex considering the desired feedrates with all the velocity/acceleration constraints of all the axes involved as well as the curvature of the path and look ahead of curvature and constraints.  KMotionCNC uses the parameters set in the Trajectory Planner not the KFLOP settings to do the planning.  See:
    A simple analogy I like to use is to imagine planning a trajectory for your car to accelerate to 60MPH in 10 seconds and then cruise at 60MPH.  If you change your mind and decide to go 120MPH by running the Trajectory twice as fast, the result will be accelerating to 120MPH in 5 seconds which probably isn't possible (requires 4X the acceleration).  Similarly to go 30MPH would result in a 20 second acceleration which wouldn't fail but would be highly sub-optimal.
    For simple paths that are relatively slow and constant speed where accelerations aren't critical it may work ok.  If I would have known you wanted to do dynamic acceleration and velocity I would have pushed you more in the direction of doing the Trajectory Planning in KFLOP (Although not nearly as capable as the PC Trajectory Planner).
    Anyway the current instantaneous commanded feedrate can be easily computed within KFLOP.  See the VelocityToPWM.c example which controls a PWM output proportional to the current xy feedrate.
    HTH
    Regards
    TK


    On 7/7/2016 11:02 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

    There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi SJH,

    I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
    Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

    Guillaume
     


    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

    As with any feedback control, you need to consider stability.

    One way to help might be to limit the change in FRO at any step.  So instead of

      fro *= d/c;

    try something like

      newfro = fro * d/c;
      if (newfro < fro * 0.995) fro *= 0.995;
      else if (newfro > fro * 1.005) fro *= 1.005;
      else fro = newfro;

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
    One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

    Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

    Code something like this might work:

    double fro = 1.;
    SetFRO(fro);
    for (;;) {
      double c = get_current_feed_rate();
      double d = get_desired_max_feed_rate();
      if (c > d) {  // slow down
         fro *= d/c;
         SetFRO(fro);
      }
      else { // speed up
         if (c > 0.)
           fro *= d/c;
           if (fro > 1.) fro = 1.;
         }
         else
             fro = 1.;
         SetFRO(fro);
      }
      WaitNextTimeSlice();
    }

    Please report back whether this works; I might want to use it myself one day.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi all,

    Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

     Here is how I figured out my stand alone application :

    1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

    2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

    3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

    4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

    Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

    What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

    Guillaume

     




    On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Hi Guillaume,
    I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

    But for stand alone operation I see two basic approaches:
    #1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
    I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
    You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
    #2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
    Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
    In either case you can

    (Message over 64 KB, truncated)
    Group: DynoMotion Message: 13507 From: Hardy Family Date: 7/7/2016
    Subject: Re: Stand alone application
    Make sure Speed is a float (or double) variable, and make sure the printf() has "%f" for the format for that variable.  printf() is not "smart": you need to give it the correct format and corresponding variable types, otherwise it will print totally bogus values.  In particular, it will not automatically convert between float and int.  Use %d with int, and %f with float or double.  Float in the parameter list is always converted to double, which is why %f works for either.

    The units are in steps/sec.  The kflop itself doesn't really have the concept of inch or mm.  You effectively define the "units" when you specify the output gain. 

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 1:35 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     

    Hello Tom and SJH,

    I'm trying to figure out how what are the units of the speed ... when I printf the speed defined by :
     
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel); 

    and I take a sample every second, the result is -536870912. I don't understand how this value can be negative since it is the result of a sqrtf... I've looked in the KMotionDef.h and in  http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk
    but I didn't find the units. (My axis resolution is 3200 step/ rev and 40,33 mm/rev and the speed reference was 8000mm/min)


    Guillaume

    PS : I need this information to try SJH's idea. To do so I need a speed reference.





    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 3:36 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Looks like Yahoo disallowed the attachment.  it is included in V4.33 and pasted below.
    Regards
    TK
    #include "KMotionDef.h"

    // Drives PWM output proportional to current Speed

    #define FACTOR 0.01f  // factor to convert speed to PWM counts

    main()
    {
        float Speed;
        int PWM;
       
        SetBitDirection(26,1);          // define bit as an output
        FPGA(IO_PWMS_PRESCALE) = 13;      // divide clock by 13 (5 KHz)
        FPGA(IO_PWMS) = 0;                 // PWM off
        FPGA(IO_PWMS+1) = 1;              // Enable

        for(;;)
        {
            WaitNextTimeSlice();
            // compute xy speed in counts/sec
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel);
            PWM = (int)(Speed * FACTOR);     // scale PWM
            if (PWM>255) PWM=255;            // limit to max PWM
            FPGA(IO_PWMS) = PWM;             // output PWM
        }
    }


    On 7/7/2016 12:28 PM, Tom Kerekes tk@... [DynoMotion] wrote:
     
    Here is the VelocityToPWM.c example attached.
    Regards
    TK

    On 7/7/2016 12:16 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    Hi Tom,

    I can't find that VelocityToPWM sample (at least not in 433q).

    I would think that controlling the FRO to create a "speed limit" would be just as good as re-planning the trajectory.  Even though accelerations are stretched out by the square of the speed ratio, it's not important if the max speed is being "clamped", since with constant speed (over a linear segment) the accelerations are zero by definition.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 11:48 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi Guillaume,
    Trying to change accelerations and velocities after he motion has already been planned is very difficult.  Trajectory Planning is very complex considering the desired feedrates with all the velocity/acceleration constraints of all the axes involved as well as the curvature of the path and look ahead of curvature and constraints.  KMotionCNC uses the parameters set in the Trajectory Planner not the KFLOP settings to do the planning.  See:
    A simple analogy I like to use is to imagine planning a trajectory for your car to accelerate to 60MPH in 10 seconds and then cruise at 60MPH.  If you change your mind and decide to go 120MPH by running the Trajectory twice as fast, the result will be accelerating to 120MPH in 5 seconds which probably isn't possible (requires 4X the acceleration).  Similarly to go 30MPH would result in a 20 second acceleration which wouldn't fail but would be highly sub-optimal.
    For simple paths that are relatively slow and constant speed where accelerations aren't critical it may work ok.  If I would have known you wanted to do dynamic acceleration and velocity I would have pushed you more in the direction of doing the Trajectory Planning in KFLOP (Although not nearly as capable as the PC Trajectory Planner).
    Anyway the current instantaneous commanded feedrate can be easily computed within KFLOP.  See the VelocityToPWM.c example which controls a PWM output proportional to the current xy feedrate.
    HTH
    Regards
    TK


    On 7/7/2016 11:02 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

    There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi SJH,

    I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
    Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

    Guillaume
     


    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

    As with any feedback control, you need to consider stability.

    One way to help might be to limit the change in FRO at any step.  So instead of

      fro *= d/c;

    try something like

      newfro = fro * d/c;
      if (newfro < fro * 0.995) fro *= 0.995;
      else if (newfro > fro * 1.005) fro *= 1.005;
      else fro = newfro;

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
    One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

    Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

    Code something like this might work:

    double fro = 1.;
    SetFRO(fro);
    for (;;) {
      double c = get_current_feed_rate();
      double d = get_desired_max_feed_rate();
      if (c > d) {  // slow down
         fro *= d/c;
         SetFRO(fro);
      }
      else { // speed up
         if (c > 0.)
           fro *= d/c;
           if (fro > 1.) fro = 1.;
         }
         else
             fro = 1.;
         SetFRO(fro);
      }
      WaitNextTimeSlice();
    }

    Please report back whether this works; I might want to use it myself one day.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi all,

    Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

     Here is how I figured out my stand alone application :

    1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

    2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

    3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

    4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

    Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

    What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

    Guillaume

     




    On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Hi Guillaume,
    I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

    But for stand alone operation I see two basic approaches:
    #1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
    I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
    You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the examples in the \C Programs\FlashNonVolatile\ directory for how to flash and restore memory.
    #2 - In this approach the HMI would specifie a simple pattern like a a rectangle or ellipse parametrically and C code in KFLOP creates the Coordinated motion on-the-Fly.  For simple straight line motions such as rectangles, lines, triangles and such see the  CoordMotionInKFLOPTest.c example (which uses functions in CoordMotionInKFLOPFunctions.c).  For a fractional Ellipse see the Ellipse.c example. 
    Th Ellpse example was created for a user utilizing a tangential knife glass cutting machine.  Although a Computer running Mach3 was used to enter the ellipse parameters the motion was created within KFLOP for a smoother and higher performance manner in essentially a stand alone mode.
    In either case you can control PWM for the Laser Power with something like the example OutputSpeedToDAC.c.  But of course you would command to a PWM instead of a DAC.  KFLOP's PWMs operate at 65KHz or at integer divisors of this frequency.
    HTH
    Regards
    TK




    (Message over 64 KB, truncated)
    Group: DynoMotion Message: 13529 From: gyelle10 Date: 7/11/2016
    Subject: Re: Stand alone application
    Hello SJH,

    I tried the programm and it takes few segments before it reaches the speed reference... I tried both version, first one is not stable as you thought and with  :

        newfro = fro * d/c;
      if (newfro < fro * 0.995) fro *= 0.995;
      else if (newfro > fro * 1.005) fro *= 1.005;
      else fro = newfro;

    it takes too much time to reach the speed refence (but it reaches the good speed).

    After thoughts, I'm not sure how this could solve the FRO issue that Tom mentionned. Even if the project is at constant speed (so acceleration = 0), it is not true for each axis (specially when doing circles) where each axis accelerate and decelerate constantly.

    I'll try just to set FRO at desired speed before an execution, and set FRO to 1 when current speed is at 0. This way the pause time specified  in the project will remain the same. I just hope the motors will support the variation of acceleration. The speed variation should not be very high anyway (FRO should be in the range of 0.5 to 1.5).

    Guillaume







    On Thursday, July 7, 2016 6:39 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Make sure Speed is a float (or double) variable, and make sure the printf() has "%f" for the format for that variable.  printf() is not "smart": you need to give it the correct format and corresponding variable types, otherwise it will print totally bogus values.  In particular, it will not automatically convert between float and int.  Use %d with int, and %f with float or double.  Float in the parameter list is always converted to double, which is why %f works for either.

    The units are in steps/sec.  The kflop itself doesn't really have the concept of inch or mm.  You effectively define the "units" when you specify the output gain. 

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 1:35 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hello Tom and SJH,

    I'm trying to figure out how what are the units of the speed ... when I printf the speed defined by :
     
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel); 

    and I take a sample every second, the result is -536870912. I don't understand how this value can be negative since it is the result of a sqrtf... I've looked in the KMotionDef.h and in  http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk
    but I didn't find the units. (My axis resolution is 3200 step/ rev and 40,33 mm/rev and the speed reference was 8000mm/min)


    Guillaume

    PS : I need this information to try SJH's idea. To do so I need a speed reference.





    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 3:36 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Looks like Yahoo disallowed the attachment.  it is included in V4.33 and pasted below.
    Regards
    TK
    #include "KMotionDef.h"

    // Drives PWM output proportional to current Speed

    #define FACTOR 0.01f  // factor to convert speed to PWM counts

    main()
    {
        float Speed;
        int PWM;
       
        SetBitDirection(26,1);          // define bit as an output
        FPGA(IO_PWMS_PRESCALE) = 13;      // divide clock by 13 (5 KHz)
        FPGA(IO_PWMS) = 0;                 // PWM off
        FPGA(IO_PWMS+1) = 1;              // Enable

        for(;;)
        {
            WaitNextTimeSlice();
            // compute xy speed in counts/sec
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel);
            PWM = (int)(Speed * FACTOR);     // scale PWM
            if (PWM>255) PWM=255;            // limit to max PWM
            FPGA(IO_PWMS) = PWM;             // output PWM
        }
    }


    On 7/7/2016 12:28 PM, Tom Kerekes tk@... [DynoMotion] wrote:
     
    Here is the VelocityToPWM.c example attached.
    Regards
    TK

    On 7/7/2016 12:16 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    Hi Tom,

    I can't find that VelocityToPWM sample (at least not in 433q).

    I would think that controlling the FRO to create a "speed limit" would be just as good as re-planning the trajectory.  Even though accelerations are stretched out by the square of the speed ratio, it's not important if the max speed is being "clamped", since with constant speed (over a linear segment) the accelerations are zero by definition.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 11:48 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi Guillaume,
    Trying to change accelerations and velocities after he motion has already been planned is very difficult.  Trajectory Planning is very complex considering the desired feedrates with all the velocity/acceleration constraints of all the axes involved as well as the curvature of the path and look ahead of curvature and constraints.  KMotionCNC uses the parameters set in the Trajectory Planner not the KFLOP settings to do the planning.  See:
    A simple analogy I like to use is to imagine planning a trajectory for your car to accelerate to 60MPH in 10 seconds and then cruise at 60MPH.  If you change your mind and decide to go 120MPH by running the Trajectory twice as fast, the result will be accelerating to 120MPH in 5 seconds which probably isn't possible (requires 4X the acceleration).  Similarly to go 30MPH would result in a 20 second acceleration which wouldn't fail but would be highly sub-optimal.
    For simple paths that are relatively slow and constant speed where accelerations aren't critical it may work ok.  If I would have known you wanted to do dynamic acceleration and velocity I would have pushed you more in the direction of doing the Trajectory Planning in KFLOP (Although not nearly as capable as the PC Trajectory Planner).
    Anyway the current instantaneous commanded feedrate can be easily computed within KFLOP.  See the VelocityToPWM.c example which controls a PWM output proportional to the current xy feedrate.
    HTH
    Regards
    TK


    On 7/7/2016 11:02 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

    There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi SJH,

    I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
    Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

    Guillaume
     


    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

    As with any feedback control, you need to consider stability.

    One way to help might be to limit the change in FRO at any step.  So instead of

      fro *= d/c;

    try something like

      newfro = fro * d/c;
      if (newfro < fro * 0.995) fro *= 0.995;
      else if (newfro > fro * 1.005) fro *= 1.005;
      else fro = newfro;

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
    One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

    Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

    Code something like this might work:

    double fro = 1.;
    SetFRO(fro);
    for (;;) {
      double c = get_current_feed_rate();
      double d = get_desired_max_feed_rate();
      if (c > d) {  // slow down
         fro *= d/c;
         SetFRO(fro);
      }
      else { // speed up
         if (c > 0.)
           fro *= d/c;
           if (fro > 1.) fro = 1.;
         }
         else
             fro = 1.;
         SetFRO(fro);
      }
      WaitNextTimeSlice();
    }

    Please report back whether this works; I might want to use it myself one day.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi all,

    Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

     Here is how I figured out my stand alone application :

    1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

    2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

    3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automatic

    (Message over 64 KB, truncated)
    Group: DynoMotion Message: 13534 From: Hardy Family Date: 7/11/2016
    Subject: Re: Stand alone application
    Did you try any values other than 0.995/1.005?  Values 0.99 and 1.01 would speed up response.  You just need to experiment until you find some values which are a good compromise between speed and stability.

    Rather than hard-coding the numbers, try something like

    #define FROFAC  1.01

    then instead of 0.995 write (1.0/FROFAC) and instead of 1.005 write FROFAC.  Then you only need to change the number in one place when experimenting.

    Regarding different axes having different acceleration, that is not a problem.  FRO still permits this without changing the shape of the motion.  FRO only specifies the speed along the tool path (tangential speed) relative to the original programmed speed.

    Regards,
    SJH


    On Mon, Jul 11, 2016 at 9:13 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     

    Hello SJH,

    I tried the programm and it takes few segments before it reaches the speed reference... I tried both version, first one is not stable as you thought and with  :

        newfro = fro * d/c;
      if (newfro < fro * 0.995) fro *= 0.995;
      else if (newfro > fro * 1.005) fro *= 1.005;
      else fro = newfro;

    it takes too much time to reach the speed refence (but it reaches the good speed).

    After thoughts, I'm not sure how this could solve the FRO issue that Tom mentionned. Even if the project is at constant speed (so acceleration = 0), it is not true for each axis (specially when doing circles) where each axis accelerate and decelerate constantly.

    I'll try just to set FRO at desired speed before an execution, and set FRO to 1 when current speed is at 0. This way the pause time specified  in the project will remain the same. I just hope the motors will support the variation of acceleration. The speed variation should not be very high anyway (FRO should be in the range of 0.5 to 1.5).

    Guillaume







    On Thursday, July 7, 2016 6:39 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Make sure Speed is a float (or double) variable, and make sure the printf() has "%f" for the format for that variable.  printf() is not "smart": you need to give it the correct format and corresponding variable types, otherwise it will print totally bogus values.  In particular, it will not automatically convert between float and int.  Use %d with int, and %f with float or double.  Float in the parameter list is always converted to double, which is why %f works for either.

    The units are in steps/sec.  The kflop itself doesn't really have the concept of inch or mm.  You effectively define the "units" when you specify the output gain. 

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 1:35 PM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hello Tom and SJH,

    I'm trying to figure out how what are the units of the speed ... when I printf the speed defined by :
     
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel); 

    and I take a sample every second, the result is -536870912. I don't understand how this value can be negative since it is the result of a sqrtf... I've looked in the KMotionDef.h and in  http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk
    but I didn't find the units. (My axis resolution is 3200 step/ rev and 40,33 mm/rev and the speed reference was 8000mm/min)


    Guillaume

    PS : I need this information to try SJH's idea. To do so I need a speed reference.





    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 3:36 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Looks like Yahoo disallowed the attachment.  it is included in V4.33 and pasted below.
    Regards
    TK
    #include "KMotionDef.h"

    // Drives PWM output proportional to current Speed

    #define FACTOR 0.01f  // factor to convert speed to PWM counts

    main()
    {
        float Speed;
        int PWM;
       
        SetBitDirection(26,1);          // define bit as an output
        FPGA(IO_PWMS_PRESCALE) = 13;      // divide clock by 13 (5 KHz)
        FPGA(IO_PWMS) = 0;                 // PWM off
        FPGA(IO_PWMS+1) = 1;              // Enable

        for(;;)
        {
            WaitNextTimeSlice();
            // compute xy speed in counts/sec
            Speed = sqrtf(ch0->last_vel*ch0->last_vel + ch1->last_vel*ch1->last_vel);
            PWM = (int)(Speed * FACTOR);     // scale PWM
            if (PWM>255) PWM=255;            // limit to max PWM
            FPGA(IO_PWMS) = PWM;             // output PWM
        }
    }


    On 7/7/2016 12:28 PM, Tom Kerekes tk@... [DynoMotion] wrote:
     
    Here is the VelocityToPWM.c example attached.
    Regards
    TK

    On 7/7/2016 12:16 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    Hi Tom,

    I can't find that VelocityToPWM sample (at least not in 433q).

    I would think that controlling the FRO to create a "speed limit" would be just as good as re-planning the trajectory.  Even though accelerations are stretched out by the square of the speed ratio, it's not important if the max speed is being "clamped", since with constant speed (over a linear segment) the accelerations are zero by definition.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 11:48 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi Guillaume,
    Trying to change accelerations and velocities after he motion has already been planned is very difficult.  Trajectory Planning is very complex considering the desired feedrates with all the velocity/acceleration constraints of all the axes involved as well as the curvature of the path and look ahead of curvature and constraints.  KMotionCNC uses the parameters set in the Trajectory Planner not the KFLOP settings to do the planning.  See:
    A simple analogy I like to use is to imagine planning a trajectory for your car to accelerate to 60MPH in 10 seconds and then cruise at 60MPH.  If you change your mind and decide to go 120MPH by running the Trajectory twice as fast, the result will be accelerating to 120MPH in 5 seconds which probably isn't possible (requires 4X the acceleration).  Similarly to go 30MPH would result in a 20 second acceleration which wouldn't fail but would be highly sub-optimal.
    For simple paths that are relatively slow and constant speed where accelerations aren't critical it may work ok.  If I would have known you wanted to do dynamic acceleration and velocity I would have pushed you more in the direction of doing the Trajectory Planning in KFLOP (Although not nearly as capable as the PC Trajectory Planner).
    Anyway the current instantaneous commanded feedrate can be easily computed within KFLOP.  See the VelocityToPWM.c example which controls a PWM output proportional to the current xy feedrate.
    HTH
    Regards
    TK


    On 7/7/2016 11:02 AM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
     
    I mean that you need to look at the speed being commanded by the kflop firmware.  This should be available without requiring any hardware encoders, but just off-hand I don't know how to do this.

    There might be a way to obtain the theoretical instantaneous speed of each axis (assuming FRO=1.0), which would make things much simpler.  Tom would have to answer this.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:54 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi SJH,

    I like the Idea ! But I don't have any feedback to look at the current speed... I'm working in open loop with step motors.
    Is there a function to get the current frequency of the PWM step output so I could compare this frequency to a desired one ? 

    Guillaume
     


    Sent from Yahoo Mail. Get the app


    On Thursday, July 7, 2016 1:31 PM, "Hardy Family hardy.woodland.cypress@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    PS: you might find some instability with the above, because the speed does not instantaneously follow the FRO.  So it might cut down the FRO too much, then have to compensate by increasing it, and the speed will start oscillating.

    As with any feedback control, you need to consider stability.

    One way to help might be to limit the change in FRO at any step.  So instead of

      fro *= d/c;

    try something like

      newfro = fro * d/c;
      if (newfro < fro * 0.995) fro *= 0.995;
      else if (newfro > fro * 1.005) fro *= 1.005;
      else fro = newfro;

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 10:03 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
    One possibility if you want a "speed limit", but without changing accelerations or dwell times: have a thread that runs continuously looking at the current speed, and calls SetFRO() to slow it down if the speed goes over the limit.

    Basically, you add a velocity control feedback loop that tries to maintain the velocity at a fixed level, but make sure you never call SetFRO with a value greater than 1.0 (otherwise it could never slow down!).

    Code something like this might work:

    double fro = 1.;
    SetFRO(fro);
    for (;;) {
      double c = get_current_feed_rate();
      double d = get_desired_max_feed_rate();
      if (c > d) {  // slow down
         fro *= d/c;
         SetFRO(fro);
      }
      else { // speed up
         if (c > 0.)
           fro *= d/c;
           if (fro > 1.) fro = 1.;
         }
         else
             fro = 1.;
         SetFRO(fro);
      }
      WaitNextTimeSlice();
    }

    Please report back whether this works; I might want to use it myself one day.

    Regards,
    SJH


    On Thu, Jul 7, 2016 at 9:32 AM, gyelle10@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     
    Hi all,

    Is there a way to change the maximum velocity/acceleration of an axis in stand alone so that even if the speed specified in the Coordinated Motion Segments is higher,  the speed will be limited to this maximum speed ?

     Here is how I figured out my stand alone application :

    1- User uses Kmotion.exe or KmotionCNC.exe to generate Coordinated Motion Segments that are stored in the CoordMotionBuffer.

    2- When he is satisfed by his project1, he presses a LOAD button that automaticly save the CoordMotionBuffer into  a specific location in Flash Memory. (allocated for project 1)

    3- When the user wants to execute his project 1, he first presses a DOWNLOAD button that automaticly copy the corresponding flash memory into the CoordMotionBuffer. Then, he press a GO button that execute the CoordMotionBuffer.

    4- With RS232, he can send Console Commands that change settings like laser power (duty cycle of a PWM output) and I would like to change the velocity/acceleration of the XY axis.

    Here is my issue : If I change the velocity/acceleration with FFVel<N>=<M>, it still uses the velocity defined in the Coordinated Motion Segments. If I use SetFRO everything is slower/faster (including the pauses in the project). 

    What I tougth is to use a very high speed in Gcode (used in the Coordinated Motion Segments) and define the maximum Vel/Acc of the axis so I could change it without redoing step 1 (see above). Is this possible ?

    Guillaume

     




    On Thursday, June 16, 2016 9:39 PM, "Tom Kerekes tk@... [DynoMotion]" <DynoMotion@yahoogroups.com> wrote:


     
    Hi Guillaume,
    I agree with Moray using a PC would be would be a much simpler approach.  Do you plan on making a lot of these so that the software effort would justify the cost savings?

    But for stand alone operation I see two basic approaches:
    #1 - You can temporarily use a PC and define and run a GCode Path in a normal manner.  In this case the GCode Interpreter and Trajectory Planner running in the PC will create a Buffer of Coordinated Motion Segments and download them to KFlop's memory and execute it.  The Coordination Motion Buffer memory can then be saved to Flash Memory.  Later in Stand alone mode the memory can be restored and re-executed.  KFLOP has 2 MBytes of Flash Memory.  1 MByte is available for User Data Storage.  A single Coordinated Motion Segment requires 216 bytes of memory.  So 1 MByte could save a maximum of ~4800 segments.  Something like a simple rectangle may only require about a dozen segments.   Something like an ellipse may require a few hundred segments.
    I recall one user using this method for a stand alone automated cake decorator to repeatedly dispense fixed patterns like "Happy Birthday".
    You would need to create code to Flash the data, keep track of each set of data, copy it back when needed, etc.  See the

    (Message over 64 KB, truncated)